#include <Servo.h>
Servo S;
const int button = 4;
int buttonstate = 0;
void setup() {
S.attach(9);
pinMode(button, INPUT);
S.write(0);
}
void loop() {
buttonstate = digitalRead(button);
if(buttonstate == 1){
S.write(180);
delay(3000);
S.write(0);
}
}