<!-- Source: https://medius.k4tech.net/library/led -->
# LED

_Drive a status LED, or hand it back to the box_

[`led`](/library/led.md#led) overrides one of the box's two green status LEDs, or with [`LedMode::Auto`](/library/types/enums.md#led-mode) returns it to the box's own status display. It's [fire-and-forget](/native/injection.md#fire-and-forget): one frame, no reply.

## led

_Override or restore a status LED_

```text
fn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>
```

_Fire-and-forget_

[`LedTarget`](/library/types/enums.md#led-target) picks which chip's LED, and [`LedMode`](/library/types/enums.md#led-mode) picks what to drive it to; both enums and their bytes are on [Types](/library/types/enums.md).`level` is brightness `0..=255`, used by `Solid` and `Blink` and ignored for `Off` and `Auto`.

#### PARAMETERS

| Parameter | Type | Description |
| --- | --- | --- |
| `target` | [`LedTarget`](/library/types/enums.md#led-target) | Which chip's LED: `Device`, `Host`, or `Both`. |
| `mode` | [`LedMode`](/library/types/enums.md#led-mode) | `Auto` restores the status display; `Off`, `Solid`, and `Blink` override it. |
| `level` | `u8` | Brightness 0-255 for `Solid` and `Blink`; ignored otherwise. |

An override holds until you send `Auto`, and the box also reverts the LED to its status display on control-PC silence, on [`reset`](/library/admin.md#reset), or on inter-chip link loss. See the native [`LED`](/native/commands/led.md#led) command for the status patterns each chip shows.

#### EXAMPLE

```rust
use medius::{Device, LedTarget, LedMode};

let device = Device::find()?;
device.led(LedTarget::Both, LedMode::Blink, 200)?;   // both LEDs blink, bright
device.led(LedTarget::Device, LedMode::Auto, 0)?;    // hand the device LED back
```

## On AsyncDevice

_Still fire-and-forget, no await_

[`AsyncDevice`](/library/features/async.md) re-exposes `led` unchanged: it expects no reply, so there's no `.await` and no [`block_on`](https://docs.rs/futures/latest/futures/executor/fn.block_on.html). Only the queries are async.

#### EXAMPLE

```rust
use medius::{AsyncDevice, LedTarget, LedMode};

let device = AsyncDevice::open("/dev/ttyACM0")?;
device.led(LedTarget::Host, LedMode::Solid, 128)?;   // sync, no await
```
