Open Portia-Lin opened 2 years ago
A temporary solution: Derive a subclass from AccelStepper,
(1) override the 'run' function, adding a test for a new 'estopTriggered' flag. IF the flag is not set, then call AccelStepper::run().
(2) create new fucntion estop() that sets this flag, AND sets _stepInterval to 0.
(3) Create new function reset_estop() that clears the flag to restore normal operations.
Hello everyone. I would like to stop the stepper motor immediately after the limit switch has been triggered. If I call the
stop()
function, the stepper motor starts to decrease its speed depending on the given acceleration. I need to stop the stepper motor now, so I use the code:if (stepper.isRunning()) { stepper.moveTo(stepper.currentPosition()); }
It works. But there is a problem. After I set another position to move again, the stepper motor starts moving at maximum speed without using acceleration. This may cause the stepper motor in my device to jam. Are there any other solutions to this problem? To set the movement speed, I use thesetMaxSpeed()
functions, and for the stepper motor movement:run()
.