#include <Servo.h>
Servo myServo;
int potPin=0;
int value;
void setup() {
myServo.attach(9);
}
void loop() {
//potentionmeter value is between 0 to 1023
value=analogRead(potPin);
//scale potention meter with servo value (0 to 180)
//map 1023 to 180 degree.
value = map(value,0,1023,0,180);
myServo.write(value);
delay(50);
}