For the complete documentation index, see llms.txt. This page is also available as Markdown.

3. Beginner: double-press detector

Difficulty: Beginner

double-press-detector.gpc
define DOUBLE_PRESS_MS = 300;

int double_press_count;

main {
    if(event_press(PS5_CROSS) && get_brtime(PS5_CROSS) <= DOUBLE_PRESS_MS) {
        double_press_count = double_press_count + 1;
    }

    set_val(TRACE_1, double_press_count);
    set_val(TRACE_2, get_brtime(PS5_CROSS));
}

Device-test first-press behavior after load and tune the threshold for the intended controller/user.

Last updated