Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduboy.h>
- Arduboy arduboy;
- uint8_t button = 0;
- void setup() {
- arduboy.beginNoLogo();
- arduboy.clear();
- }
- void loop() {
- if (button == 0) {
- if (arduboy.pressed(UP_BUTTON))
- button = UP_BUTTON;
- else if (arduboy.pressed(RIGHT_BUTTON))
- button = RIGHT_BUTTON;
- else if (arduboy.pressed(LEFT_BUTTON))
- button = LEFT_BUTTON;
- else if (arduboy.pressed(DOWN_BUTTON))
- button = DOWN_BUTTON;
- else if (arduboy.pressed(A_BUTTON))
- button = A_BUTTON;
- else if (arduboy.pressed(B_BUTTON))
- button = B_BUTTON;
- if (button != 0) {
- arduboy.clear();
- arduboy.setCursor(0, 0);
- arduboy.print(button);
- arduboy.display();
- }
- } else if (arduboy.notPressed(UP_BUTTON | RIGHT_BUTTON | LEFT_BUTTON | DOWN_BUTTON | A_BUTTON | B_BUTTON))
- button = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement