#include <Servo.h>
Servo myServo;
const int buttonPin = 10;
void setup() {
// put your setup code here, to run once
myServo.attach(11);
pinMode(buttonPin, INPUT);
myServo.write(90);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(buttonPin) == HIGH){
myServo.write(0);
delay(5000);
myServo.write(90);
}
else
if (digitalRead(buttonPin) == LOW){
myServo.write(90);
}
}