Notifications
Clear all

Asynchronous stepper motor library.  

  RSS

Amin
 Amin
(@amin)
Active Member
Joined: 10 months ago
Posts: 5
2020-07-19 12:22 am  

Greetings,

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.

 


Quote
Ruplicator
(@ruplicator)
Estimable Member
Joined: 7 months ago
Posts: 110
2020-07-20 3:28 am  

@amin

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.


ReplyQuote
Amin
 Amin
(@amin)
Active Member
Joined: 10 months ago
Posts: 5
2020-07-20 7:03 pm  

@ruplicator

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.  


ReplyQuote