-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathkeypad.ino
More file actions
30 lines (30 loc) · 748 Bytes
/
keypad.ino
File metadata and controls
30 lines (30 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
Serial.begin (115200);
Serial.println ("Open Project Keypad.txt");
Serial.println ("Press a key");
}
unsigned long timeout = 0;
void loop()
{
char key;
if (millis() > timeout)
{
timeout = millis() + 100;
key = keypad.getKey();
if (key)
Serial.println ( key );
}
}