#include <Servo.h>
#include <LiquidCrystal_I2C.h>
#define pinServo 3
#define pinButton 2
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo myservo ;
void setup() {
// put your setup code here, to run once:
myservo.attach(pinServo);
pinMode(pinButton, INPUT);
lcd.init();
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
int value = digitalRead(pinButton);
if(digitalRead(pinButton)==HIGH){
myservo.write(0);
lcd.setCursor(0, 0);
lcd.print(" Open ");
delay(15);
}
else{
myservo.write(90);
lcd.setCursor(0, 0);
lcd.print(" Close ");
delay(15);
}
}