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