Hey guys, the issue here is that my servo only seems to turn by itself very little, and is not affected by the potentiometer at all. I can't seem to find what I'm doing wrong.
Here is my code:
#include <Servo.h>
Servo myServo;
int const potPin = A0;
int potVal;
int angle;
void setup() {
myServo.attach(9);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
potVal = analogRead(potPin);
Serial.print("potVal: ");
Serial.print(potVal);
angle = map(potVal, 0, 1023, 0, 179);
Serial.print(", angle: ");
Serial.println(angle);
myServo.write(angle);
delay(15);
}
Here is what the readings look like:
angle: 62
potVal: 360, angle: 62
potVal: 376, angle: 65
potVal: 360, angle: 62
potVal: 360, angle: 62
potVal: 359, angle: 62
potVal: 359, angle: 62
potVal: 359, angle: 62
potVal: 359, angle: 62
potVal: 358, angle: 62
potVal: 358, angle: 62
potVal: 358, angle: 62
potVal: 358, angle: 62
potVal: 358, angle: 62
potVal: 357, angle: 62
potVal: 357, angle: 62
potVal: 357, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 356, angle: 62
potVal: 355, angle: 62
potVal: 355, angle: 62
potVal: 355, angle: 62
potVal: 355, angle: 62
potVal: 355, angle: 62
potVal: 355, angle: 62
potVal: 354, angle: 61
potVal: 353, angle: 61
potVal: 354, angle: 61
potVal: 354, angle: 61
potVal: 354, angle: 61
potVal: 353, angle: 61
potVal: 353, angle: 61
potVal: 353, angle: 61
potVal: 353, angle: 61
potVal: 352, angle: 61
potVal: 352, angle: 61
potVal: 352, angle: 61
potVal: 352, angle: 61
It just seems to barely turn and isn't affected by the potentiometer at all
Here is a picture of my circuit:
Thanks for the help