This is my first post, got the Arduino starter kit a couple of days ago and have been working through the projects. i decided i wanted to challenge myself and came up with the idea to control a servo with a potentiometer and have the angle it is at displayed on an lcd.
all went well breadboarding it and it works fine except for the display, i have it so it says [Angle: 0] on start up and will increase up to [Angle: 178] just like i want.
but the problem comes when i decrease the angle, it will keep 2 digits if it has been into double figures or three if triple.
for example; if i move the servo up to 100 then back to 0 it will display [Angle: 027] (the last 2 digits seem random, never the same)
i dont think i have explained it very well sorry.
the code i have for this in loop is:
potVal = analogRead(potPin);
Serial.print(" Pot Val: ");
deg = map(potVal, 0, 1023, 0, 178);
Serial.print(" Angle: ");