PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

38 lines
894B

  1. /* @file CustomKeypad.pde
  2. || @version 1.0
  3. || @author Alexander Brevig
  4. || @contact alexanderbrevig@gmail.com
  5. ||
  6. || @description
  7. || | Demonstrates changing the keypad size and key values.
  8. || #
  9. */
  10. #include <Keypad.h>
  11. const byte ROWS = 4; //four rows
  12. const byte COLS = 4; //four columns
  13. //define the cymbols on the buttons of the keypads
  14. char hexaKeys[ROWS][COLS] = {
  15. {'0','1','2','3'},
  16. {'4','5','6','7'},
  17. {'8','9','A','B'},
  18. {'C','D','E','F'}
  19. };
  20. byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad
  21. byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad
  22. //initialize an instance of class NewKeypad
  23. Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
  24. void setup(){
  25. Serial.begin(9600);
  26. }
  27. void loop(){
  28. char customKey = customKeypad.getKey();
  29. if (customKey){
  30. Serial.println(customKey);
  31. }
  32. }