# LED Reference

## Overview

iReporter can drive hardware LEDs on your iReporter Button Box to provide visual indicators for active crash/incident timers and the Blue Flag Helper approach warning.

## Serial Protocol

iReporter communicates with the button box using a simple text-based protocol over the configured COM port at 9600 baud. Each LED command is a single line in the format:

```
LED;{COLOUR};{STATE};
```

Where:

- **COLOUR** — one of: `RED`, `BLUE`, `GREEN`, `AMBER`
- **STATE** — `1` to turn the LED on, `0` to turn it off

Examples:

```
LED;RED;1;      (turn red LED on)
LED;RED;0;      (turn red LED off)
LED;AMBER;1;    (turn amber LED on)
```

## LED Assignments

<table id="bkmrk-featuresettingbehavi"><thead><tr><th>Feature</th><th>Setting</th><th>Behaviour</th></tr></thead><tbody><tr><td>Crash Capture</td><td>Timeout LED (in Crash Capture settings)</td><td>Steady ON while crash is active (timed mode) — OR — brief 600ms flash on capture (No Timeout mode)</td></tr><tr><td>Incident Capture</td><td>Timeout LED (in Incident Capture settings)</td><td>Steady ON while incident is active (timed mode) — OR — brief 600ms flash on capture (No Timeout mode)</td></tr><tr><td>Blue Flag Helper</td><td>Approach LED (in Blue Flag Helper settings)</td><td>ON when a top-X leader is within the configured gap AND more than 1 full lap ahead</td></tr></tbody></table>

## Timed vs No Timeout LED Behaviour

The crash and incident LEDs behave differently depending on the timeout setting:

<table id="bkmrk-timeout-settingled-b"><thead><tr><th>Timeout Setting</th><th>LED Behaviour</th><th>Data Cleared When</th></tr></thead><tbody><tr><td>Timed (1–60s)</td><td>Stays ON for the full timeout duration, then turns OFF</td><td>Timeout expires</td></tr><tr><td>No Timeout (0)</td><td>Flashes ON for 600ms on detection, then turns OFF</td><td>Next crash/incident is detected (overwrites previous)</td></tr></tbody></table>

The brief flash in No Timeout mode confirms that a crash or incident has been captured without implying it is still pending — the data remains available in message variables indefinitely.

## Colour Options

<table id="bkmrk-optiondescriptionnon"><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td>None</td><td>No LED output for this feature</td></tr><tr><td>RED</td><td>Red LED</td></tr><tr><td>BLUE</td><td>Blue LED</td></tr><tr><td>GREEN</td><td>Green LED</td></tr><tr><td>AMBER</td><td>Amber / orange LED</td></tr></tbody></table>

## Notes

- iReporter only sends a new LED command when the state changes — it does not repeatedly send the same command.
- Multiple features can use different colours simultaneously (e.g. RED for crash, AMBER for incident).
- If two features are assigned the same colour, the last state change wins. It is recommended to assign a unique colour to each feature.
- The COM port and baud rate (9600) are fixed. Ensure your iReporter Button Box firmware listens on 9600 baud and parses the `LED;COLOUR;STATE;` format.