User Control of RGB Breathing

Does anyone know if breathing the on-board RGB is supported? If I take control of the RGB, do I need to set up a Timer to obtain this functionality, or is it already built in??

Hi @hagandh. There’s a new feature in 0.6.1-rc1 which provides an API for that and doesn’t require taking control over the LED or maintaining timers manually: https://github.com/spark/firmware/blob/develop/wiring/inc/spark_wiring_led.h#L70

The feature is not documented yet, but here’s an example:

// Using LED_PRIORITY_IMPORTANT to override any system-specific status currently indicated by the LED
LEDStatus breatheRed(RGB_COLOR_RED, LED_PATTERN_FADE, LED_SPEED_NORMAL, LED_PRIORITY_IMPORTANT);

void setup() {
    // Show breathing red for 3 seconds
    breatheRed.setActive(true);
    delay(3000);
    breatheRed.setActive(false);
}

void loop() {
}
1 Like