#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int btnsum = 0;
int btnminus = 1;
int btnzero = 6;
int btnpote = 7;
int a = 0;
int lastBtnpoteState = HIGH;
void setup() {
lcd.begin(16, 2);
pinMode(btnsum, INPUT_PULLUP);
pinMode(btnminus, INPUT_PULLUP);
pinMode(btnzero, INPUT_PULLUP);
pinMode(btnpote, INPUT_PULLUP);
}
void loop() {
lcd.setCursor(0, 0);
lcd.print(a);
int btnpoteState = digitalRead(btnpote);
if (btnpoteState == LOW && lastBtnpoteState == HIGH) {
a = analogRead(A0);
delay(200);
}
lastBtnpoteState = btnpoteState;
if (digitalRead(btnsum) == LOW) {
a++;
delay(200);
}
if (digitalRead(btnminus) == LOW) {
a--;
delay(200);
}
if (digitalRead(btnzero) == LOW) {
a = 0;
delay(200);
}
lcd.print(" ");
delay(200);
}