#include <Servo.h>
Servo myservo;
int potpin = 0;
int val;
void setup() {
pinMode(3, OUTPUT);
// put your setup code here, to run once:
myservo.attach(9);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(3, LOW);
delay(5000);
val = analogRead(potpin);
val = map(0, 1023, 0, 0, 90);
myservo.write(val);
delay(5000);
digitalWrite(3, HIGH);
delay(5000);
val = map(0, 1023, 0, 180, 0);
myservo.write(val);
delay(5000);
}