#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#include<Servo.h>
Servo servo;
const int buttonPin = 2;
int statusBtn =0;
void setup() {
pinMode(buttonPin, INPUT);
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.backlight();
servo.attach(5);
}
void loop() {
// put your main code here, to run repeatedly:
statusBtn = digitalRead(buttonPin);
if (statusBtn == HIGH){
servo.write(0);
lcd.print("TERBUKA");
delay(50);
lcd.clear();
}else{
servo.write(90);
lcd.print("TERTUTUP");
delay(50);
lcd.clear();
}
}