Project 5 - servo wont turn.

Hi. I just started Arduino and have worked my way through project 1-4 with- well not too much trouble. Just a little bit.

Now I’m stuck at project 5. The servo wont turn. I can see that the numbers are changing when I turn the potentiometer, but nothing happens with the servo. If i try the servo expample under Files, it all works just fine, which makes me believe it’s connected/wired properly, but when I upload my codes, which I really just copied from the book, no servo action. I know there might be an error with the code, but after staring at it, re-checking it and re-checking again, watching videos, reading forums about the same issue (i didnt always understand the answer and I am kinda sure it isnt a wireing issue) I might have become blind to what ever error is there. Any suggestion is appreciated.

If you think the pins on the potentiometer looks funny, it’s because after spending and hour trying make them stick to the breadboard, I had no skin left on my fingers and i just solder some smaller pins to them. Its ugly I know, but its working.

I apologise if the code isnt ment to be posted like this, but here it is:

#include <Servo.h>

Servo myServo;

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

void setup() {

void loop() {
potVal = analogRead(potPin);
Serial.print("potVal: ");

angle = map(potVal, 0, 1023, 0, 179);

Serial.print(", angle: ");


Hello I just looked through your code. The reason your servo motor is not moving is because you write:


instead of


So you are not giving the servo motor a variable input it just moves to the position “90” and stays there.

Hope it helps :slight_smile: