Debouncing problems with AVR...(likely a misuse of variable).

view story

http://forum.allaboutcircuits.com – Hi all- I'm currently trying to debounce some buttons in an AVR project with Kenneth Kuhn's debounce algorithm. The problem is that I can't seem to get "IF buttonpressed, do something" to work. This is likely a simple problem, here's what I'm doing. 20 times a second a timer interrupt calls the debounce algorithm. Since there's 4 buttons (I'm only testing 1 currently), I've created array variables (buttonInput[4], integrator[4], etc.)to store the data required by the debounce function. If the debounceOutput variable is a 0, i set buttonPressed to 1 and buttonReleased to 0 (and vice (Embedded)