As many of you may know that there is thing called an analog button. You use one analog pin to sense a few buttons:https://www.google.com/search?q=arduino+analog+button&source=lnms&tbm=isch&sa=X&ei=kL_5UqbwK4OTyQGM-oDQBw&ved=0CAoQ_AUoAg&biw=1920&bih=922
There are a few drawbacks to this design so I made some improvements.
1) You can not have too many buttons, or the analog values get too close. Considering resistors can be only as accurate as 1% (not paying for high precision resistors), if you produce a product that needs 10 resistors, chances are, your analog values are getting quite close. It's not even split from 0 to 1023.
2) You can have more buttons if you use two or more analog pins but each group of buttons need their separate resistors. Too many resistors.
1) Use the internal pull-up to save one resistor (or not).
2) Use digital pins to scan a matrix of buttons all hooked up to one set of resistors.
Here is what I came up with (about 2 years ago):
So I used this design on my phi-panel
to save some pins. I also attached one button directly to 5V. This is problematic only when this key is pressed with another key in the matrix, which I should tell the panel users not to do. A typical matrix keypad with 16 keys costs 8 digital pins, a bit too many. This one only costs 4 pins. Any interest? Comments?