Skip to main content

Class RgbLed

Utility functions to provide blinking and pulsing for RgbLed

Assembly: Meadow.Foundation.dll
View Source
public class RgbLed : IRgbLed, IDisposable

Implements:
Meadow.Peripherals.Leds.IRgbLed, System.IDisposable

Properties

Color

The current LED color

View Source
public RgbLedColors Color { get; protected set; }

RedPort

The red LED port

View Source
protected IDigitalOutputPort RedPort { get; set; }

GreenPort

The green LED port

View Source
protected IDigitalOutputPort GreenPort { get; set; }

BluePort

The blue LED port

View Source
protected IDigitalOutputPort BluePort { get; set; }

Common

The common type (common anode or common cathode)

View Source
public CommonType Common { get; protected set; }

IsOn

Turns on LED with current color or turns it off

View Source
public bool IsOn { get; set; }

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

Methods

StopAnimation()

Stops the current LED animation

View Source
public Task StopAnimation()
Returns

System.Threading.Tasks.Task

Start the Blink animation which sets turns the LED on and off on an interval of 1 second (500ms on, 500ms off)

View Source
public Task StartBlink()
Returns

System.Threading.Tasks.Task

StartBlink(RgbLedColors)

Start the Blink animation which sets turns the LED on and off on an interval of 1 second (500ms on, 500ms off)

View Source
public Task StartBlink(RgbLedColors color)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Peripherals.Leds.RgbLedColorscolorThe LED color

StartBlink(RgbLedColors, TimeSpan, TimeSpan)

Start the Blink animation which sets turns the LED on and off with the specified durations and color

View Source
public Task StartBlink(RgbLedColors color, TimeSpan onDuration, TimeSpan offDuration)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Peripherals.Leds.RgbLedColorscolorThe LED color
System.TimeSpanonDurationThe duration the LED stays on
System.TimeSpanoffDurationThe duration the LED stays off

StartBlink(TimeSpan, TimeSpan)

Start the Blink animation which sets turns the LED on and off with the specified durations and current color

View Source
public Task StartBlink(TimeSpan onDuration, TimeSpan offDuration)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.TimeSpanonDurationThe duration the LED stays on
System.TimeSpanoffDurationThe duration the LED stays off

SetColor(RgbLedColors)

Sets the current color of the LED.

View Source
public void SetColor(RgbLedColors color)
Parameters
TypeNameDescription
Meadow.Peripherals.Leds.RgbLedColorscolorThe color value

UpdateLed(bool)

Turns on LED with current color or LED off

View Source
protected void UpdateLed(bool isOn)
Parameters
TypeNameDescription
System.BooleanisOnTrue for on, False for off

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
public virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • Meadow.Peripherals.Leds.IRgbLed
  • System.IDisposable