Section
Getting Started
API
Features
Guides
Reference
AI Access
LED
Drive a status LED, or hand it back to the boxled overrides one of the box's two green status LEDs, or with LedMode::Auto returns it to the box's own status display. It's fire-and-forget: one frame, no reply.
led
Override or restore a status LEDfn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>
Fire-and-forget
LedTarget picks which chip's LED, and LedMode picks what to drive it to; both enums and their bytes are on Types.level is brightness 0..=255, used by Solid and Blink and ignored for Off and Auto.
PARAMETERS
| Parameter | Type | Description |
|---|---|---|
target | LedTarget | Which chip's LED: Device, Host, or Both. |
mode | LedMode | 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, or on inter-chip link loss. See the native LED command for the status patterns each chip shows.
EXAMPLE
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 backOn AsyncDevice
Still fire-and-forget, no awaitAsyncDevice re-exposes led unchanged: it expects no reply, so there's no .await and no block_on. Only the queries are async.
EXAMPLE
use medius::{AsyncDevice, LedTarget, LedMode};
let device = AsyncDevice::open("/dev/ttyACM0")?;
device.led(LedTarget::Host, LedMode::Solid, 128)?; // sync, no await