#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const int resetButtonPin = 4;
const int countButtonPin = 2;
int count = 0;
void setup() {
lcd.begin(16, 2);
pinMode(resetButtonPin, INPUT_PULLUP);
pinMode(countButtonPin, INPUT_PULLUP);
}
void loop() {
if (digitalRead(countButtonPin) == LOW) {
count++;
lcd.setCursor(7, 0);
lcd.print(" ");
lcd.setCursor(7, 0);
lcd.print(count);
delay(200);
}
if (digitalRead(resetButtonPin) == LOW) {
count = 0;
lcd.setCursor(7, 0);
lcd.print(" ");
lcd.setCursor(7, 0);
lcd.print(count);
delay(200);
}
}