# Status-LED.h Controls the discrete onboard status LEDs (green, blue, red, and the status LED) for system indication and feedback. > For the addressable WS2812B LED strip, see **[RGB-LED.h](RGB-LED)** instead. ## Enumerations ### `led_status_e` Selects which LED `Set_LED()` controls. ```cpp typedef enum { GREEN, // Green LED BLUE, // Blue LED RED, // Red LED STATUS // Status LED } led_status_e; ``` ### `led_state_e` The state to apply. ```cpp typedef enum { OFF = 0, // LED off ON, // LED on TOGGLE // Toggle current state } led_state_e; ``` ## Global Variables - `bool LedStatusState` - Current on/off state of the status LED. ## Functions ### `void Set_LED(led_status_e _led_status, led_state_e _state)` Sets an LED to `ON`, `OFF`, or `TOGGLE`. Set a fixed state once in `onLoopStart()`, or update it dynamically in `plutoLoop()`. ```cpp void plutoLoop ( void ) { Set_LED ( GREEN, ON ); // solid green Set_LED ( STATUS, TOGGLE ); // blink the status LED each loop } ``` ## Usage Example Set an initial state on entry, drive status indication in the loop, and turn the LEDs off on exit. ```cpp #include "PlutoPilot.h" Interval heartbeat; // Dev button pressed: start with green on. void onLoopStart ( void ) { Set_LED ( GREEN, ON ); Set_LED ( BLUE, OFF ); Set_LED ( RED, OFF ); } // While active: reflect system status on the LEDs. void plutoLoop ( void ) { // Arm state: blue when armed, green when disarmed. if ( FlightStatus_Check ( FS_ARMED ) ) { Set_LED ( BLUE, ON ); Set_LED ( GREEN, OFF ); } else { Set_LED ( GREEN, ON ); Set_LED ( BLUE, OFF ); } // Low-battery blink (Voltage is in mV). if ( Bms_Get ( Voltage ) < 3300 ) { Set_LED ( RED, TOGGLE ); } else { Set_LED ( RED, OFF ); } // Heartbeat on the status LED once per second. if ( heartbeat.set ( 1000, true ) ) { Set_LED ( STATUS, TOGGLE ); } } // Dev button released: turn everything off. void onLoopFinish ( void ) { Set_LED ( GREEN, OFF ); Set_LED ( BLUE, OFF ); Set_LED ( RED, OFF ); } ```