#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define btnUP 8
#define btnDW 7
#define btnSL 6
int btnDel = 150;
int btnUP_S;
int btnDW_S;
int btnSL_S;
int count = 0;
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(btnUP, INPUT_PULLUP);
pinMode(btnDW, INPUT_PULLUP);
pinMode(btnSL, INPUT_PULLUP);
lcd.init();
lcd.backlight();
lcd.print("LCD Display Tutorial");
lcd.setCursor(0,0);
}
void loop() {
// put your main code here, to run repeatedly:
if(!digitalRead(btnUP)){
count++;
lcd.setCursor(0,1);
lcd.print(count);
delay(btnDel);
if (count >5){
count = 5;
lcd.setCursor(0,1);
lcd.print(count);
}
}
if(!digitalRead(btnDW)){
count--;
lcd.setCursor(0,1);
lcd.print(count);
delay(btnDel);
if(count <1){
count=1;
lcd.setCursor(0,1);
lcd.print(count);
}
}
}