It’s standard universal buttonbox.
The sketch supports up to 25 buttons and up to 4 encoders.
Wiring is quite simple:
You can use any number of buttons up to 25 and any number of encoders up to 4 — no sketch modification is needed!
For example, I use only 15 buttons (4 switches + 4 buttons + 3 encoders buttons), so my matrix is 4×4 and I wired it`s rows to 21, 20, 19, 18 pins and columns to 14, 16, 10, 9 pins
I wrote two versions of sketch — the first one emulates a keyboard and the second one — a joystick.
You can use keyboard emulating sketch if, for example, your game doesn’t support remapping hot keys. In other cases (or if you don’t know which version you need) just use joystick version because it’s simpler. You have to download Joystick library for it:
And please be sure you are using Arduino IDE version 1.6.6 or above
You can download sketches here