Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  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.  
  12. const byte ROWS = 4; //four rows
  13. const byte COLS = 3; //three columns
  14. char keys[ROWS][COLS] = {
  15. {'1','2','3'},
  16. {'4','5','6'},
  17. {'7','8','9'},
  18. {'*','0','#'}
  19. };
  20. byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
  21. byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
  22.  
  23. Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
  24.  
  25. void setup(){
  26. Serial.begin(9600);
  27. }
  28.  
  29. void loop(){
  30. char key = keypad.getKey();
  31.  
  32. if (key){
  33. Serial.println(key);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement