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.

36 lines
748B

  1. /* @file HelloKeypad.pde
  2. || @version 1.0
  3. || @author Alexander Brevig
  4. || @contact alexanderbrevig@gmail.com
  5. ||
  6. || @description
  7. || | Demonstrates the simplest use of the matrix Keypad library.
  8. || #
  9. */
  10. #include <Keypad.h>
  11. const byte ROWS = 4; //four rows
  12. const byte COLS = 3; //three columns
  13. char keys[ROWS][COLS] = {
  14. {'1','2','3'},
  15. {'4','5','6'},
  16. {'7','8','9'},
  17. {'*','0','#'}
  18. };
  19. byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
  20. byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
  21. Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
  22. void setup(){
  23. Serial.begin(9600);
  24. }
  25. void loop(){
  26. char key = keypad.getKey();
  27. if (key){
  28. Serial.println(key);
  29. }
  30. }