When using microcontrollers you would normally connect one button to one input. What to do if you are running out of inputs and still have a bunch of buttons to monitor? This clever trick uses the analog input that many microcontrollers have available to monitor the buttons on a single input by having them put a different voltage on the pin based on which one is pressed.
Via: Electronics Lab
“The theory of connecting multiple switches on a single ADC input channel is very simple. One end of each switch is connected to the power supply voltage through an individual pull-up resistor, whereas the other end is grounded through a common resistor. When a switch is pressed, it creates a voltage divider network between the power supply and ground terminals. The value of the divided voltage can be made unique for all four switches by selecting different values of pull-up resistors. The voltage is then measured with the ADC to determine which switch has been pressed.”