Servo jitter

Hello, i ve just got an arduino startet kit ( love it ) but i just reached a project where it asked me to program a servomotor and control it through a potentiometer. But as soon as i connect it to power the servo just starts to jitter unless i change the value in my code to something specifc but i still can 't control it more than that. The serial monitor shows almost the same continuous value( the angle is 70-80 and potVal 400-490). Im super new to all of this so maybe i missed something, but i did everything like it said in the book. Bellow is the code i used.

#include <Servo.h>
Servo myServo;

int const potPin = A0;
int potVal;
int angle;

void setup() {
myServo.attach(10);

Serial.begin(9600);

}

void loop() {
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);

}

If potVal doesn't change as you move the potentiometer then it isn't connected properly. I'd guess that the wire from the centre pin to pin A0 isn't making a good connection. If you're sure it is connected try a different piece of wire, they sometimes break inside the insulation which can be really confusing.

Otherwise please post a picture of your circuit clearly showing all the wires etc.

Steve

Almost all the servo jitter problems posted on this forum are due to an inadequate servo power supply. DO NOT attempt to use the Arduino 5V output to power a servo, as doing so will damage the Arduino.

Instead, use a 4xAA battery pack to power the servo, and connect the grounds (negative lead of battery pack to servo minus, and Arduino GND).