3 * Demonstrate the simplest use of the keypad library.
5 * The first step is to connect your keypad to the
6 * Arduino using the pin numbers listed below in
7 * rowPins[] and colPins[]. If you want to use different
8 * pins then you can change the numbers below to
14 const byte ROWS = 4; // Four rows
15 const byte COLS = 3; // Three columns
17 char keys[ROWS][COLS] = {
30 // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
31 byte rowPins[ROWS] = {
33 // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
34 byte colPins[COLS] = {
38 Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
44 pinMode(ledpin,OUTPUT);
45 digitalWrite(ledpin, HIGH);
51 char key = kpd.getKey();
52 if(key) // Check for a valid key.
57 digitalWrite(ledpin, LOW);
60 digitalWrite(ledpin, HIGH);