Created
May 26, 2024 04:23
-
-
Save ohsix/9f398e2d95ef63a41a793e7b47940391 to your computer and use it in GitHub Desktop.
frame based button thing, inspired by the quake 3 input code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
at the moment buttons are added explicitly, can be nicer as a library | |
in setup: | |
buttonState[BTN_DO].arduinoPin = BTN_PIN1; | |
buttonState[BTN_NEXT].arduinoPin = BTN_PIN2; | |
buttonsBegin(); | |
in loop: | |
updateButtons(); | |
if(buttonHeld(BTN_DO, 1000)) /* been held for 1000 milliseconds */ | |
if(buttonPressed(BTN_NEXT)) /* pressed, only triggers once, in the same 'frame' updateButtons just read */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment