/*
 Controlling a servo position using a potentiometer (variable resistor)
 by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

 modified on 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo ;
int potpin = 0;
int val;
void setup( ) {
myservo.attach(9);
}
void loop( ) {
val = analogRead(potpin);
val = map(val, 10, 1000, 0, 179);
myservo.write(val);
}