Step 4
I kind of cheated when I mapped the key values. I basically just put bogus unique characters in the 2 dimensional array that defines the keys then I just started pushing buttons and had my Arduino output the keys pushed to serial. Then I could look at the output to set the 2 dimensional array for the library to the right values.
That seemed kind of confusing so I'll do an example. As part of the keypad library you define a 2 dimensional array so it knows what keys correspond to the values on the matrix. So basically it's something like this:
char keys[ROWS][COLS] = {
{'<','>','+',' ','5','4','3','2'},
{'^','*','%','#','6','1','Z','Y'},
{'X','W','V','U','T','S','R','Q'},
{'P','O','N','M','L','K','J','I'},
{'H','G','F','E','D','C','B','A'}
};
I'd then push a button on the keypad ('A' for example). Then I'd look at what came out on the serial console (say it was 'W', then I'd go and replace the 'W' in the matrix with an 'A'). After I went through all the keys then I had the keypad all mapped up.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|
















































