analogRead from potmeter doesn't work correctly?

i am busy playing with my new motorshield from adafruit, i’ve modified the code to control a DC motor a bit so i can control the speed of the motor with a 10K potentiometer, here is the code;

#include <AFMotor.h>

AF_DCMotor motor(1, MOTOR12_64KHZ);
int potPin = 0;
int var0 = 0;
void setup() {
}

void loop() {
  var0 = analogRead(potPin);
  motor.setSpeed(var0);
  motor.run(FORWARD);
}

but,
(there’s always a but, no exceptions)

when i turn my pot fully clockwise the motor is off, when i turn my pot to ~25% it’s at maximum speed and when i turn it at ~26% it’s off and then at ~50% it’s at maximum speed and when it is at ~51% it is off, this continue’s till 100%.

if i use a 10 ohm pot the motor stops when i turn the pot all clockwise and when i turn it to the max, nothing happens, it then takes about 15 seconds before it starts at maximum speed (like it’s hanging or something).

can someone help me with this problem?

The analog input is a 10-bit value ranging from 0 to 1023. The range for var0 is apparently smaller. From your description, 25%, etc, it would seem to take a byte input (0 to 255 range). So after "var0 = analogRead(potPin);" add "var0 = var0 / 4;" this will reduce var0 to a range from 0 to 255.

it works! thanks.