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