#include <Keypad.h>
char tombol[4][4] =
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte pinBaris[] = {2, 3, 4, 5};
byte pinKolom[] = {6, 7, 8, 9};
Keypad keypad = Keypad(makeKeymap(tombol), pinBaris, pinKolom, 4, 4);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
char kode = keypad.getKey();
if (kode != NO_KEY)
Serial.println(kode);
}