#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const int up = 2;
const int down = 3;
int nomor = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
pinMode(up, INPUT_PULLUP);
pinMode(down, INPUT_PULLUP);
}
void loop() {
byte tombol1 = digitalRead(up);
byte tombol2 = digitalRead(down);
if (tombol1 == LOW && nomor < 23) {
nomor++;
delay(200);
}
if (tombol2 == LOW && nomor > 0) {
nomor--;
delay(200);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Nomor Urut : ");
if (nomor < 10) {
lcd.print("0");
}
lcd.print(nomor);
}