This program demonstrates how to series-connect five pushbuttons over one I/O pin, so that they can all be read in parallel by taking an ADC measurement and scanning a threshold table to determine their binary pattern. The program includes automatic debounce, too.
This may be accomplished with two resistor values: (5) 150 ohm and (5) 1.2K ohm with 1% tolerance like this:
- Two (2) 1.2K ohm in series for the 2.4K ohm (this is an acceptable substitute for the 2.2K ohm value)
- One (1) 1.2K ohm for the 1.2K ohm
- Two (2) 1.2K ohm in parallel for the 600 ohm
- Two (2) 150 ohm in series for the 300 ohm
- One (1) 150 ohm for the 150 ohm
- Two (2) 150 ohm in parallel for the 75 ohm value.
Parallax will offer these resistors and five pushbuttons in a bag for those who wish to prototype with this circuit. Expected release date early March, 2021.
Compile with DEBUG to run this program. The DEBUG features create the graphic shown above from the Propeller Tool software and simulate what you’ll observe when you build the circuit and press the buttons in any possible combination.