I have a limit switch hooked up to a digital input from a DAQ1301_0 Phidget.
The switch needs to be debounced. I currently use Software Approach #1 from here:
http://www.labbookpages.co.uk/electronics/debounce.html
I have a solution where basically:
1. On state change, temporarily save the digital input state and a timestamp
2. Start a thread
3. In the thread, monitor for timestamp updates for a certain time window.
- The time window is a debounce timeout (ms)
4. If no timestamp updates during that time window, accept the temporary state as a debounced state
This largely a brute force way. Is there a more elegant method to do debouncing, that integrates with state change handlers?