Asymmetric keyboard matrix and keypad

Hi everyone,

Starting to plan to integrate an Arduino Mega with an existing keyboard matrix and the Keypad library seems like a perfect fit.

But unlike all examples that I've seen, the keyboard I'm working with has asymmetric rows - by that I mean, for instance one of the rows has 5 keys, and the other two might have 7. The question is, would the Keypad library handle a setup like that?

Thanks a lot!

If there is not a great deal of asymmetry, you could define bogus pins for the missing keys on the shorter rows, such as 255.

Since the Arduino can't read from pin 255, you will never be told that the non-existent button was pressed.

Should work fine, assuming the Keypad library has no hard limits for dimensions. If it does, it would be easy enough to modify the C++ file in the library.

There is a freely downloadable example of using this library in project 10 of my book '30 Arduino Projects for the Evil Genius' here:

Follow the link for downloads and you can grab a zip of all the sketches.

That's great. Thank you both for the suggestions!