Solved! - Multistepper feedback

Hey guys,
I'm currently building something using stepper motors.
Controlling everything works fine.
The only thing I cannot seem to find is how i know when the blocking is lifted on the runspeedtoposition() function.
Let's just assume i want a LED to light up if there's no block.
As soon as the runspeedtoposition() function is called the LED turns off.

Anyone have any suggestions?

Thanks in advance!

Does that mean when the steppers have reached their desired position (destination)?

The runSpeedToPosition() function is a blocking function. You cannot change that. If you do not want blocking use the run() function.

You can call the distanceToGo() function on individual steppers while running MultiStepper.

Hi,
I know it's a blocking function. And that's fine.
I just want to get feedback, to know all steppers have reached there final destination.

I've tried the "stepper1.isRunning()" but, deu to the blocking nature, that doesn't work. At lease in my program it didn't work.

But i will try the distanceToGo() function.

Didn't think of that.

Will come back to let you know if that works.

Thanks

Yeah, since runSpeedToPosition() is blocking, distanceToGo() won't work either. If you could figure out a way to use run() then run() returns 0 when all motors have reached their destinations and, of course, the other functions could be used.

Why not write the code to be non-blocking?

Kind of simple, while runspeedtoposition() runs al 6 steppers to reach there destination at the same time.
Saves me alot of math.. (lazy)

BUT, the distanceToGo() works actually.
I've written it so that if distanceToGo() == 0 ... do something.

And thats work 100%.

Now when my steppers reach there end location, the next action takes place.

As long as the steppers are running, distancetogo() > then 0 the next action "is blocked"

So, problem solved!!

Thanks for the help!

Please mark the thread as solved so that other members that wish to help will not waste their time opening the thread only to find it solved.

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