#include<Keypad.h>
const byte Rows=4;
const byte cols=4;
char hexaKeys[Rows][cols]={
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
byte rowPins[Rows]={5,4,3,2};
byte colPins[cols]={9,8,7,6};
Keypad customKeypad=Keypad(makeKeymap(hexaKeys),rowPins,colPins,Rows,cols);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
char customKey=customKeypad.getKey();
if(customKey){
Serial.println(customKey);
}
}