Uno with Motor Shield - problem reading potentiometer values

I'm learning... 2nd day user
read lots of posts trying to match my problem but was not successful.

Uno
Motor Shield
12v 7amp battery
DC motor
10k potentiomter

I'm simply trying to change the direction of the motor with the pot but with the Motor Shield connected to the Uno the serial monitor is showing me values from 2 to 1013 from the pot. It moves from 2 to 40 ish and then jumps to 1000. I never see any values between 40 ish and 1000. When I have the Motor Shield disconnected and pot connected to the same pins using the same code I get the desired results of 0-1023 from the pot in the Serial Monitor. What i see in the Serial Monitor is what I'm seeing with the motor operation.

code:

void setup() {
//Setup Channel A
pinMode(12, OUTPUT); //Initiates Motor Channel A
pinMode(9, OUTPUT); //Initiates Brake Channel A
pinMode(A0, INPUT);

digitalWrite(9, LOW); //Disengage the Brake

digitalWrite(12, LOW); //Set direction
analogWrite(3, 255); //Channel A at full speed

Serial.begin(9600); //setup serial monitor

}

void loop() {

int potval = analogRead(A0);
delay(30);
Serial.println(potval);
delay(1); // delay in between reads for stability

//map values
potval = map(potval, 0, 1023, -255, 255);

if (potval < 0) {
//spin left
digitalWrite(12, HIGH);
}
else {
//spin right
digitalWrite(12, LOW);
}

//val without sign
int abso = abs(potval);

//constrain it to 0-255 to be sure
constrain(abso,0,255);

//set speed
analogWrite(3, abso);

// Serial.println(abso);
//delay(1000); // delay in between reads for stability

You have no shielding on the analog circuitry? It runs near the motor cable?

Firstly I'd add 100nF or 1uF on the analog pin to ground to cut out the noise,
that might well be the problem.

Secondly if the pots on the end of some loose wires you replace with a neat
shielded cable or twist the wires tightly together so its not an antenna
loop.

This kind of code is cumbersome:

  if (potval < 0) {
    //spin left
    digitalWrite(12, HIGH);
  }
  else {
    //spin right
    digitalWrite(12, LOW);
  }

when you can simply say:

  boolean spin_left = potval < 0 ;
  digitalWrite (12, spin_left) ;

Is the motor shield the official one? Because if it is, then A0 and A1 are connected to the current sensing on the motor driver chip. Try using A2 and see if it makes a difference.

Ah, that's much more likely to be it!

Thanks MarkT and Patouf! I changed from A0 to A3 and it worked perfectly. On to the next step cause of you guys. Thanks