#include <Servo.h>
Servo myservo;
// declaration
int potPin = A0;
int potValue;
int angle;
void setup() {
myservo.attach(9);
}
void loop() {
potValue = analogRead(potPin);
angle = map(potValue, 0, 1023, 0, 180);
myservo.write(angle);
delay(15);
}