#include <Servo.h>
Servo myServo;
const int buttonPin = 2;
const int servoPin = 9;
int buttonState = 0;
void setup() {
pinMode(buttonPin, INPUT);
myServo.attach(servoPin);
myServo.write(0);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
myServo.write(90);
} else {
myServo.write(0);
}
}