User Access to the MODE Button?

Ok with a little bit of code we can pretty cleanly wait for Smart Config to catch before we take over the Mode button :wink:

uint32_t startTime = 0;
void setup() {
    startTime = millis(); // capture the time that our app starts
}

void loop() {
    if(ModeBtnPressed()) {
        RGB.control(true);
        RGB.color(255, 255, 255);
        delay(1000);
        RGB.control(false);
    }
}

bool ModeBtnPressed() {
    if(millis() - startTime > 3000) { // wait at least 3s for smart config
        if(BUTTON_GetDebouncedTime(BUTTON1) >= 250) {
            BUTTON_ResetDebouncedState(BUTTON1);
            return 1;
        }
    }
    return 0;
}

@timb access granted! :smile:

6 Likes