Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- WWW.SANTY.CZ
- Díl 10 - klávesnice 4x4
- konektor 8 pinů
- */
- #include <Keypad.h> //připojíme knihovnu
- const byte ROWS = 4; // 4 řádky
- const byte COLS = 4; // 4 sloupce
- // zde si napíšete jak Vaše
- // membránová klávesnice vypadá
- char hexaKeys[ROWS][COLS] = {
- {'1','2','3','A'},
- {'4','5','6','B'},
- {'7','8','9','C'},
- {'*','0','#','D'}
- };
- byte rowPins[ROWS] = {9, 8, 7, 6}; //čísla pinů s řadkem 1 2 3 4
- byte colPins[COLS] = {5, 4, 3, 2}; //čísla pinu se sloupcem 1 2 3 4
- //inicializuje objekt klávesnice s názvem customKeypad
- Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
- void setup(){
- Serial.begin(57600);
- }
- void loop(){
- // přečte znak z klávesnice
- char customKey = customKeypad.getKey();
- // když není customKey null tak pošli znak na Serial port
- if (customKey){
- Serial.println(customKey);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement