#include <LiquidCrystal_I2C.h> //library lcd
#include <Servo.h> //library servo
LiquidCrystal_I2C lcd(0x27,16,2);
Servo sr1;
Servo sr2;
void setup() {
lcd.init();
sr1.attach(10);
sr2.attach(11);
Serial.begin(9600);
pinMode(4, INPUT);
}
void loop() {
if(digitalRead(4) == HIGH){
sr1.write(90);
//delay(200);
sr2.write(0);
//delay(200);
lcd.setCursor(0,0);
lcd.print("Ada Logam");
//delay(200);
lcd.setCursor(0,1);
lcd.print("................");
//delay(200);
}
else if(digitalRead(4) == LOW){
sr1.write(0);
//delay(200);
sr2.write(90);
//delay(200);
lcd.setCursor(0,0);
lcd.print("................");
//delay(200);
lcd.setCursor(0,1);
lcd.print("Tidak Ada Logam");
//delay(200);
}
}