// Potentiometer controls servo position #include Servo servo1; // create a servo1 servo object const int potPin = A4; const int servoPin = 9; int position = 0; // Store a value in position int delay1 = 300; //The Arduino 10-bit ADCs map 0v to 5v between 0 and 1023 inclusive const float conversionFactor = 180.0/1023.0; // Servo moves between 0 & 180 degrees void setup() { servo1.attach(servoPin); // Attach the servo object to the servo Pin } void loop() { // Read the potentiometer pin and adjust the postion of the servo // in consonance with that reading position = analogRead(potPin)*conversionFactor; servo1.write(position); delay(delay1); }