#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]={9,8,7,6};
byte colpins[cols]={5,4,3,2};
Keypad customKeypad= Keypad(makeKeymap(hexakeys),rowpins,colpins,rows,cols);
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
char customkeys=customKeypad.getKeys();
if (customkeys){
Serial.println(customkeys);
}
// put your main code here, to run repeatedly:
}