Asynchronous stepper motor library.
I have an arduino mega that's connected to two stepper motors. Each stepper motor has one stop/limit switch that would indicate the end of the travel distance. I'm using "AccelStepper" library to control the motors. I'm also using the "Eventually" event-based lib to do perform some action when an event occurs.
Everything works great in serial fashion. But I need to have a few things run at the same time. The two stepper motors, for example. The issue that I have is AccelStepper is blocking meaning that once I call "runToPosition" function call, nothing else happens unless and until the function returns.
I looked at "Metro" and "Chrono" packages but again since the "runToPosition" is a blocking function call, everything comes to the halt until the function call returns.
Of course, one thing I can do is move each motor a few degrees in a loop with AccelStepper lib or just pulsing it. But I was wondering if there is any stepper motor libs that are asynchronous? Something like fire-and-forget. Thanks all.
I'd be surprised if such a library exist. There would be no way for a library function to get back control once it relinquished it. However, it is fairly simple for you to do it using the one step method you mentioned or several other means.
Thanks. I tried one-step method but it's painfully slow with AccelStepper and the stepper motor that I have. Going to look at raspberry pie to see if I can control the GPIO in an async fashion.