Here is the Code: void setup() { // put your setup code here, to run once: pinMode(3,OUTPUT) pinMode(2,OUTPUT); pinMode(1,OUTPUT); myservo.attach(9); pinMode(5,INPUT_PULLUP) pinMode(6,INPUT_PULLUP) }

void loop() { while(digitalRead(5) == HIGH)
{ delay(100); //If button press } digitalWrite(2,LOW); //then red light turns on digitalWrite(3,HIGH); //then green light turns off myservo.write(0); //then servo/door closes

while(digitalRead(6) == HIGH) { delay(100); //If button press } digitalWrite(2,HIGH); //then red light turns off digitalWrite(3,LOW); //then green light turns on myservo.write(190); //then servo/door opens

Built With

Share this project:

Updates