Page 1 of 1

ezsetup button to change stations

Posted: Fri Jul 31, 2009 4:57 am
by highrisc
I have successfully implimented a posting regarding the use of the ezsetup button to change stations. I have soldered to the contacts for the ezsetup button, a switch to run to the outside of the radio. I appear to have a problem with switch bounce where it executes the mpc next command too many times, and the device hangs.
does anyone have a hardware/software solution to resolve this?

Re: ezsetup button to change stations

Posted: Sun Aug 02, 2009 1:08 pm
by mightyohm
In hardware, you can play with series resistors and capacitors to ground on the switch lines. There are some examples in this document I found, google will turn up lots of other suggestions:

http://www.ganssle.com/debouncing.pdf

In software, the easiest way would be to alter your code to detect the switch being pressed, wait a short delay, and then check again to make sure the switch is still pressed. This will hopefully make your program more immune to the short glitches in the switch state that occur due to bounce.