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.

HelloKeypad.ino 748B

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