- Joined
- Dec 8, 2013
- Messages
- 2,651
You won't get an event on a limit swtich unless you've hit a limit: that's something that needs immediate service. Interrupts will be disabled in the ISR. You can handle the debouncing there or disable interrupts globally and set a volatile variable to tell the main loop it has a limit switch event to deal with. Better, though, would be to use optical interrupters (or SR FFs and SPDT switches) and eliminate bounce.
Use a timer interrupt to poll the manual switch every 100ms. Only run the debounce code if it shows a change of state.
Use a timer interrupt to poll the manual switch every 100ms. Only run the debounce code if it shows a change of state.