#include <Servo.h>
Servo myServo;
int servoPin = 11;
int leftButtonPin = 10;
int rightButtonPin = 9;
int servoAngle = 90;
void setup() {
myServo.attach(servoPin);
pinMode(leftButtonPin, INPUT_PULLUP);
pinMode(rightButtonPin, INPUT_PULLUP);
myServo.write(servoAngle);
}
void loop() {
if (digitalRead(leftButtonPin) == LOW) {
myServo.write(0);
delay(500);
while (digitalRead(leftButtonPin) == LOW) {
delay(10);
}
}
//
if (digitalRead(rightButtonPin) == LOW) {
myServo.write(90);
delay(500);
while (digitalRead(rightButtonPin) == LOW) {
delay(10);
}
}
}