I have 8 sets of 8 push buttons. There is a Teensy and a demultiplexer. The demultiplexer has 8 outputs. When an output is selected it is pulled low. Each output is connected to a group of 8 push buttons. The 8 push buttons are then connected to 8 pullup inputs on the Teensy.
Each group of 8 push buttons is connected to a unique demultiplexer output, but all the push buttons are connected to the same 8 inputs on the Teensy. That is, push button #1 in group 1 shares a Teensy input with push button #1 in group 2. The push buttons are isolated from each other with diodes.
bounce.h for debouncing. It looks for rising and falling edges.
The problem is this:
- Push button #1 in group #1 is pressed, pulling that input low, causing a falling edge to be detected. This is good.
- The demultiplexer shifts to group #2, where the #1 button hasn't been pressed, and thus is high.
- Because both #1 buttons in group #1 and #2 share the same input line, the Teensy sees this change as a rising edge. This is undesired.
What is the better approach to this?