#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(6,INPUT);
pinMode(4,INPUT);
attachInterrupt(digitalPinToInterrupt(2), faqih, FALLING);
}
void loop() {
int keadaanbutton1 = digitalRead(6);
int keadaanbutton2 = digitalRead(4);
if (keadaanbutton1 == HIGH)
{
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
lcd.setCursor(2,0);
lcd.print("jalan kanan");
delay(4000);
lcd.clear();
}
if (keadaanbutton2 == HIGH)
{
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
lcd.setCursor(2,0);
lcd.print("jalan kiri");
delay(4000);
lcd.clear();
}
}
void faqih()
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}