Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <Arduboy.h>
  2.  
  3. Arduboy arduboy;
  4.  
  5. uint8_t button = 0;
  6.  
  7. void setup() {
  8. arduboy.beginNoLogo();
  9. arduboy.clear();
  10. }
  11.  
  12. void loop() {
  13. if (button == 0) {
  14. if (arduboy.pressed(UP_BUTTON))
  15. button = UP_BUTTON;
  16. else if (arduboy.pressed(RIGHT_BUTTON))
  17. button = RIGHT_BUTTON;
  18. else if (arduboy.pressed(LEFT_BUTTON))
  19. button = LEFT_BUTTON;
  20. else if (arduboy.pressed(DOWN_BUTTON))
  21. button = DOWN_BUTTON;
  22. else if (arduboy.pressed(A_BUTTON))
  23. button = A_BUTTON;
  24. else if (arduboy.pressed(B_BUTTON))
  25. button = B_BUTTON;
  26.  
  27. if (button != 0) {
  28. arduboy.clear();
  29. arduboy.setCursor(0, 0);
  30. arduboy.print(button);
  31. arduboy.display();
  32. }
  33. } else if (arduboy.notPressed(UP_BUTTON | RIGHT_BUTTON | LEFT_BUTTON | DOWN_BUTTON | A_BUTTON | B_BUTTON))
  34. button = 0;
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement