PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CustomKeypad.ino 894B

3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  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. }