Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interruping blocking-mode functions (e.g., limit switch) #38

Open
luriomer opened this issue May 14, 2024 · 0 comments
Open

Interruping blocking-mode functions (e.g., limit switch) #38

luriomer opened this issue May 14, 2024 · 0 comments

Comments

@luriomer
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant