Direct
Last updated
Last updated
Direct wiring is the simplest but most pin-consuming way to wire your switches. It is a good option if you have only a few switches and enough microcontroller inputs. You won't need any diodes, pullup resistors or other integrated circuits. When using direct wiring, you can completely disregard your planned matrix. You'll bring the two together later when you start working on the code.
For switches that has only two pins (typical pushbuttons or on/off toggles), one will go to a microcontroller input and one will go to ground. These are switches that use 1 block in your planned matrix.
For switches that use several blocks, each pin that has a column in the switch table goes to a microcontroller input, and the common pin goes to ground. As seen below with the encoders.
In this example you can see a button matrix and two direct wired 2-bit encoders.
A little bit of extra attention to the code is required, more on that here.