#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int a = 0; // jumlah putaran yang diatur pada awalnya
int c = 0; // penghitung putaran arus
int clr = 4;
int up = 5;
int down = 6;
int motor = 9;
int startt = 3;
int sn = 2;
int f = 0;
void setup()
{
lcd.init ();
lcd.begin(16,2);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("JUMLAH P:");
pinMode(motor,OUTPUT);
pinMode(clr,INPUT_PULLUP);
pinMode(startt, INPUT_PULLUP);
pinMode (up, INPUT_PULLUP);
pinMode (down, INPUT_PULLUP);
pinMode(sn, INPUT);
}
void loop()
{
if (digitalRead (up) == HIGH)
{
delay(200);
a=a+1;
if (a>3000)
{
a=3000;
}
while (digitalRead (up) == HIGH)
{
lcd.setCursor(11, 0); // atur kursor ke baris kedua
lcd.print(a);
lcd.print(" ");
delay(50);
a=a+10;
}
}
}