I am also using the arduino uno and the motor shield to run the stepper. I have everything working but when I set the stepper to go 360 degrees, there is a lag at each rotation rather than a continuous loop.
I am assuming that it is the motor itself which is the stepper motor from sparkfun 2 phase, 12v and 2.3kg holding torque. I am open to any motor suggestions or a code suggestion which I have included as well.
thanks in advance.
Code: Select all
#include <AFMotor.h>
AF_Stepper motor(48, 1);
int potPin = 0; //analog pin ued to connect the sensor
int val = 0; //variable to read the value from the analog pin
void setup()
{
Serial.begin(9600); //for watching the speeds in the serial monitor
motor.setSpeed(200); // 200 rpm
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
val = map(val,0,1023,0,179);
if (val>60)
motor.step(360, FORWARD, SINGLE);
else
motor.release();
Serial.println("stop");
delay(10);
}