You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application I'd like to incorporate limit switches that would stop the motor immediately when engaged (e.g., when reaching a hardstop).
For non-blocking mode functions (i.e., constantly calling run() or runSpeed() inside a loop) it is pretty straight-forward by either interrupts or polling. No problem there.
I wonder if there is a way to do the same for blocking functions, such as runToPosition(). Even if I interrupt to set a flag or whatever, as soon as the ISR function returns (which will be very shortly, if it's just setting a flag) the motor will continue the movement (and if a hard stop was reached it will just slip and won't move).
So basically what I am looking for is a way to use interrupts to conditionally break out runToPosition.
I would say this is a pretty basic feature that many other might need.
Thanks!
The text was updated successfully, but these errors were encountered:
Hey I had the same problem and I thought it has some blocking mechanism. And yes there is. In file: AccelStepper.cpp at line 418 there is :
// Caution 200ns setup time
// Delay the minimum allowed pulse width
delayMicroseconds(_minPulseWidth);
This part here is blocking the system to run smoothly. The best solution that I was able to do is the flowing:
Add: YIELD; // Let system housekeeping occur
After the 418 line. This will allow you to run the system smoothly and still it is not thew best solution.
Hello,
In my application I'd like to incorporate limit switches that would stop the motor immediately when engaged (e.g., when reaching a hardstop).
For non-blocking mode functions (i.e., constantly calling run() or runSpeed() inside a loop) it is pretty straight-forward by either interrupts or polling. No problem there.
I wonder if there is a way to do the same for blocking functions, such as runToPosition(). Even if I interrupt to set a flag or whatever, as soon as the ISR function returns (which will be very shortly, if it's just setting a flag) the motor will continue the movement (and if a hard stop was reached it will just slip and won't move).
So basically what I am looking for is a way to use interrupts to conditionally break out runToPosition.
I would say this is a pretty basic feature that many other might need.
Thanks!
The text was updated successfully, but these errors were encountered: