This project allows you to link up 8 push buttons, and have the Arduino read the buttons using only four wires.

The main thing is to download and extract the ShiftIn library from https://github.com/InfectedBytes/ArduinoShiftIn, and extract the ShiftIn directory into your Arduino/libraries directory.

 

Once you have done this, the code will compile and you can upload.

 

Open the Serial Monitor and when you press a button, the byte value will be printed to the console.

 

Any input that is not connected to a pushbutton needs to be pulled down to ground.