#include <Servo.h>
Servo myservo;
int pos = 00;
void setup() {
pinMode(8, INPUT_PULLUP);
myservo.attach(9);
}
void loop(){
if (digitalRead(8)==LOW){
for(pos = 00; pos < 90; pos += 1)
{
myservo.write(pos);
delay(20);
}
}
if (digitalRead(8)==LOW){
for(pos = 90; pos>=1; pos-=1)
{
myservo.write(pos);
delay(20);
}
}
}