Timing without blocking loops
enum { TIMER_IDLE, TIMER_WAIT_RELEASE };
int timer_state;
main {
if(timer_state == TIMER_IDLE) {
if(event_press(PS5_CROSS)) timer_state = TIMER_WAIT_RELEASE;
} else if(timer_state == TIMER_WAIT_RELEASE) {
if(event_release(PS5_CROSS)) timer_state = TIMER_IDLE;
}
}Last updated

