#include <LiquidCrystal.h>
#include <ezButton.h>
LiquidCrystal lcd(51, 53, 49, 47, 45, 43, 41);
ezButton button1(6); // create ezButton object that attach to pin 6;
ezButton button2(5); // create ezButton object that attach to pin 5;
int count = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // initialize serial
lcd.begin(16,2);
lcd.print("Hello, World!");
lcd.setCursor(0,1);
lcd.print("Counter: ");
button1.setDebounceTime(50); // set debounce time to 50 milliseconds
button2.setDebounceTime(50); // set debounce time to 50 milliseconds
}
void loop() {
button1.loop(); // MUST call the loop() function first
button2.loop(); // MUST call the loop() function first
if(button1.isPressed()) {
count = count + 1;
}
if(button2.isPressed()) {
count = count - 1;
}
lcd.setCursor(9,1);
lcd.print(count);
}