Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- WWW.SANTY.CZ
- Díl 10 - klávesnice 1x6 + LED
- konektor 9 pinů
- poslední dva piny jsou pro LED diodu, předposlední je GND, poslední je +5V (pozor, použijte 200k odpor)
- */
- #include <Keypad.h> //připojíme knihovnu
- const byte ROWS = 1; // 1 řádek
- const byte COLS = 6; // 4 sloupců
- // zde si napíšete jak Vaše
- // membránová klávesnice vypadá
- char hexaKeys[ROWS][COLS] = {
- {'1','2','3','4','5','6'}
- };
- byte rowPins[ROWS] = {2};
- byte colPins[COLS] = {3, 4, 5, 6, 7, 8};
- //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