Stepper motor blocks when its job is done

Hi there
I am using Adafruit stepper motor with the AccelStepper motor library to make my school project. I am trying to use the motor to control a lead screw
I’m writing the following to my Arduino code:

void setup() {
Serial.begin(9600);
AFMS.begin(1600);
Rstepper.setMaxSpeed(1000);
initializePosition()
}

void initializePosition(){
while (Rstepper.currentPosition() != Rstepper.targetPosition()) {
if (stepToMove < Rstepper.currentPosition()) {
Rstepper.setSpeed(-1 * 250);
}
else {
Rstepper.setSpeed(250);
}

Rstepper.runSpeedToPosition();
}
}
The code works. But when when the motor moved to its target position, it kinda blocks there. I couldn’t rotate it with my hand unless I try really hard. The program jumped out of this while loop when the job is done according to my test. but the motor continued blocking and the current remains the same as when it is running. The motor also turned warmer and warmer. Can someone tell me how to fix this? or is this normal? I called disableOutputs() after this job and it didn’t work. Neither did Rstepper.stop();
Thanks to whoever may help

Your stepper motor is working exactly as stepper motors are designed to work.

Look at your stepper controller board. Somewhere it has a pin to enable/disable the controller. This is the pin to set the opposite way to release the motor from the holding current.

Paul

Thanks!

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile: