AccelStepper Cancel moveTo

Hi im trying to build a homing feature and i added endstops.
My plan is to stop the movement (works) when hitting a endstop and cancel the moveTo (doesnt work).

When i release the endstop the motor still tries to reach the target position.
(im clicking the endstop for testing).

I tried doing some research and i found the .stop() call but during my research people seemed to have issues with it?

Hey, slow down!
Read this topic and use it: How to get the best out of this forum - Using Arduino / IDE 1.x - Arduino Forum

Do You want a thousand guesses to work through? Here's the first: You use AccelStepper. It's competent but not so easy to understand and use. Some functions are blocking, run until they are finished.
Other helpers suggest Moba Tools stepper library.
Either read more about AS or take a look at MobaTools.

i managed to fix it by using stop() followed by setCurrentPosition(0) and somehow it worked :person_shrugging:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.