#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define Up 11
#define Down 12
int c = 0;
void setup()
{
pinMode(Up, INPUT_PULLUP);
pinMode(Down, INPUT_PULLUP);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Up/Down Counter");
lcd.setCursor(2, 1);
lcd.print("zaher.co.il");
delay(2000);
lcd.clear();
lcd.setCursor(5, 0);
lcd.print("Counter");
}
void loop()
{
if (digitalRead(Up) == 0)
{
delay(250);
if (c == 9)
c = 0;
else
c++;
}
if (digitalRead(Down) == 0)
{
delay(250);
if (c == 0)
c = 9;
else
c--;
}
lcd.setCursor(7, 1);
lcd.print(c);
}