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?