1st tests
This commit is contained in:
28
keypad/keypad/keypad.ino
Normal file
28
keypad/keypad/keypad.ino
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <Key.h>
|
||||
#include <Keypad.h>
|
||||
|
||||
const byte rows = 4; //four rows
|
||||
const byte cols = 3; //three columns
|
||||
char keys[rows][cols] = {
|
||||
{'1','5','9'},
|
||||
{'2','6','x'},
|
||||
{'3','7','y'},
|
||||
{'4','8','z'}
|
||||
};
|
||||
byte rowPins[rows] = {1, 2, 3, 0}; //connect to the row pinouts of the keypad
|
||||
byte colPins[cols] = {21, 22, 23}; //connect to the column pinouts of the keypad
|
||||
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
char customKey = keypad.getKey();
|
||||
|
||||
if (customKey){
|
||||
Serial.println(customKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user