Button Wiring - turnracing/turnracing-diy Wiki
The easiest method with DIY is directly wiring your inputs, this has the advantage of cleaner physical wiring resulting in fewer headaches and no birds nest of wiring, but the disadvantage of limiting the number of inputs that you can have without accompanying components such as a Shift Register.
You directly wire your inputs by connecting one pin to a GPIO pin on your microcontroller and the other pin to Ground or VCC (Ground is recommended). Once you have completed this for all inputs, you can set the code to read these pins and translate them into a button press.
The other benefit of this method over Matrix Wiring is that you do not need diodes to prevent ghost inputs as they simply cannot happen with direct wiring.
This method would be the best way to create your DIY wheels or button boxes that have a small number of inputs. If you need to build something that exceeds Direct Wiring it would be advised to create a custom PCB with a matrix. See below for more information on this.
A common method with DIY is making a matrix of inputs, similar to how most Keyboards work. The benefit of matrix wiring is that you can have a large number of inputs from using a low number of pins on your microcontroller, however, it can be quite confusing as it's not as straightforward as directly wiring each input to a pin.
You create a matrix by placing your inputs in a grid - the size of this grid depends on how many inputs you need and is made up of columns and rows. You connect each of these to your microcontroller, depending on the code, it will scan this all the time, either from row to column, or column to row.
Something you should note with this method is to use diodes on either the row or column - to know whether to install the diodes on your column or row depends on your code. This is to prevent what's called ghosting where you will see ghost inputs caused by the microcontroller being unable to tell precisely which inputs on the rows and columns are being pressed if you're holding down more than one key at a time. For this reason, we recommend you to directly connect your shifter inputs to their own pins.
Sparkfun explains how this very well so it's worth having a read to get a better understanding - read from section "A Classic Example". https://learn.sparkfun.com/tutorials/button-pad-hookup-guide/all
Matrix wiring can be made a lot easier to do by creating a Breakout Board PCB.