Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <Keypad.h>
  2.  
  3. const byte ROWS = 4; // 4 řádky
  4. const byte COLS = 4; // 4 sloupce
  5.  
  6. // zde si napíšete jak Vaše
  7. // membránová klávesnice vypadá
  8. char hexaKeys[ROWS][COLS] = {
  9.   {'1','2','3','A'},
  10.   {'4','5','6','B'},
  11.   {'7','8','9','C'},
  12.   {'*','0','#','D'}
  13. };
  14. byte rowPins[ROWS] = {9, 8, 7, 6}; //čísla pinů s řadkem 1 2 3 4
  15. byte colPins[COLS] = {5, 4, 3, 2}; //čísla pinu se sloupcem 1 2 3 4
  16.  
  17. //inicializuje objekt klávesnice s názvem customKeypad
  18. Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
  19.  
  20. void setup(){
  21.   Serial.begin(9600);
  22. }
  23.  
  24. void loop(){
  25.   // přečte znak z klávesnice
  26.   char customKey = customKeypad.getKey();
  27.  
  28.   // když není customKey null tak pošli znak na Serial port
  29.   if (customKey){
  30.     Serial.println(customKey);
  31.   }
  32. }