Need help with debouncing a pair of switches.
I'm having trouble figuring out how to debounce a pair of switches I added to a project.· I only had two pins left (pin2 and pin3).· I know how to debounce 4 or 8 switches, but not 2.· It seems to be eluding me.
Comments
What you can do is have two nibble counters, one for each switch. If a switch is open, you set its counter to zero. If a switch is closed, you increment its counter unless it's already 15. You do this in a loop that pauses for 10ms each time through the loop. If either counter goes from 14 to 15, that switch has become closed.
I was able to get it figured out. It wasn't as hard as I thought. Its amazing how some of the simple solutions can be the hardest to figure out!