I’ve written a new key input library that supports a special type of multiplexing that can scan 6 buttons using only 3 I/O pins, 10 buttons using 4 I/O pins, 15 buttons using 5 I/O pins, and so on. For more details, see my web page and video at:
[Introducing KeyPlexLib (or, ‘Wayneplexing’ on Arduino Made Easy)
Wayne](https://sites.google.com/site/wayneholder/keyplexlib-wayneplexing-on-arduino-made-easy)