The code below can be used to control a servo motor with an Arduino uno and a potentiometer. For instructions on how to used this, please follow the video tutorial below.
Additionally, check out PIA CLICK HERE for VPN services
#include <Servo.h>
Servo Servo1;
int servoPin = 9;
int potPin = A0;
void setup() {
Servo1.attach(servoPin);
}
void loop() {
int reading = analogRead(potPin);
int angle = map(reading, 0, 1023, 0, 180);
Servo1.write(angle);
}