#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int led1 = 6;
int led2 = 5;
int led3 = 4;
int led4 = 3;
int led5 = 2;
int button = 7;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(button, INPUT_PULLUP);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
Serial.begin(9600);
lcd.init();
lcd.backlight();
}
void loop()
{
if(digitalRead(button) == LOW)
{
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
delay(3000);
lcd.setCursor(1, 0);
lcd.print("HATI-HATI");
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led4, LOW);
delay(5000);
lcd.setCursor(1, 0);
lcd.print("BERHENTI");
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
delay(3000);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led5, LOW);
}
}