#include <Servo.h>
Servo myServo;
int angle[] = {0, 45, 90, 135, 180};
int currentAngle = 0;
int totalAngle = 5;
int buttonPin = 2;
int buttonPint = 2;
void setup() {
myServo.attach(9);
pinMode(buttonPin, INPUT_PULLUP);
pinMode(buttonPint, INPUT_PULLUP);
myServo.write(angle[currentAngle]);}
void loop() {
if (digitalRead(buttonPin) == LOW){
delay(50);
currentAngle = (currentAngle + 1) % totalAngle;
myServo.write(angle[currentAngle]);
delay (500);
}
if (digitalRead(buttonPint) == LOW){
delay(50);
currentAngle = (currentAngle - 1 + totalAngle) % totalAngle;
myServo.write(angle[currentAngle]);
delay (500);
}
}