Led

All boards come with an RGB led on the pcb which is controlled through the ILed interface.

using MbientLab.MetaWear.Peripheral;

ILed led = metawear.GetModule<ILed>();

Setting Patterns

The ILed interface comes with 3 preset patterns for ease of access to the LED.

Pattern Description
Blink Quickly flash the LED followed by an longer off period
Pulse Gradual and periodic transition between a low and high intensity
Solid Keep the LED on at a fixed brightness
::

using MbientLab.MetaWear.Peripheral.Led;

// use the solid preset pattern for the blue LED led.EditPattern(Color.Blue, PatternPreset.Pulse);

Developers can directly set the parameters themselves if desired using EditPattern.

// Set the green channel to turn on for 5 seconds
led.EditPattern(Color.Green, duration: 1000, highTime: 500, high: 16, low: 16, count: 5);

Pattern Playback

Controlling pattern playback is handled with Play, Pause, and Stop methods. The stop method also clears programmed patterns if called with true.

// play the pattern
led.Play();

// stop and clear all patterns
led.Stop(true);