#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int button1= 7;
int led1= 2;
int led2= 3;
int led3= 4;
int led4= 5;
int led5= 6;
int buttonstatus= 0;
void setup()
{
pinMode(button1, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
lcd.init();
lcd.backlight();
}
void loop()
{
// lampu
if (digitalRead(button1)== HIGH)
{
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
lcd.setCursor(4, 0);
lcd.print("BERHENTI !");
lcd.scrollDisplayLeft();
delay(3000);
lcd.clear();
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
lcd.setCursor(4, 0);
lcd.print("BERHENTI !");
lcd.scrollDisplayLeft();
delay(5000);
lcd.clear();
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
lcd.setCursor(3, 0);
lcd.print("HATI-HATI !!");
lcd.scrollDisplayLeft();
delay(3000);
lcd.clear();
}
else
{
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
lcd.setCursor(3, 0);
lcd.print("HATI-HATI !!");
lcd.scrollDisplayLeft();
delay(3000);
lcd.clear();
}
}