Tomask4

Untitled

Oct 11th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <Keypad.h>
  2.  
  3. const byte ROWS = 4;
  4. const byte COLS = 4;
  5.  
  6. char hexaKeys[ROWS][COLS] = {
  7. {'1','2','3','A'},
  8. {'4','5','6','B'},
  9. {'7','8','9','C'},
  10. {'*','0','#','D'}
  11. };
  12. byte rowPins[ROWS] = {9, 8, 7, 6};
  13. byte colPins[COLS] = {5, 4, 3, 2};
  14.  
  15. Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
  16.  
  17. void setup() {
  18. Serial.begin(9600);
  19. }
  20.  
  21. void loop() {
  22. char customKey = customKeypad.getKey();
  23.  
  24. if (customKey) {
  25. Serial.println(customKey);
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment