Skip to main content

Class LedBarGraph

Represents an LED bar graph composed on multiple LEDs

Assembly: Meadow.Foundation.dll
View Source
Declaration
public class LedBarGraph

Properties

Count

The number of the LEDs in the bar graph

View Source
Declaration
public int Count { get; }

Percentage

A value between 0 and 1 that controls the number of LEDs that are activated

View Source
Declaration
public float Percentage { get; protected set; }

Fields

leds

Array to hold LED objects for bar

View Source
Declaration
protected Led[] leds

Methods

StopAnimation()

Stops the LED bar graph when its blinking

View Source
Declaration
public Task StopAnimation()
Returns

System.Threading.Tasks.Task

StopAnimation(int)

Stops the blinking animation on an individual LED

View Source
Declaration
public Task StopAnimation(int index)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Int32index

Blink animation that turns the LED bar graph on (500ms) and off (500ms)

View Source
Declaration
public Task StartBlink()
Returns

System.Threading.Tasks.Task

StartBlink(TimeSpan, TimeSpan)

Blink animation that turns the LED bar graph on and off based on the OnDuration and offDuration values

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

System.Threading.Tasks.Task

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

StartBlink(int)

Starts a blink animation on an individual LED on (500ms) and off (500ms)

View Source
Declaration
public Task StartBlink(int index)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.Int32indexIndex of the LED

StartBlink(int, TimeSpan, TimeSpan)

Starts a blink animation on an individual LED

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

System.Threading.Tasks.Task

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

GetTopLedForPercentage()

Returns the index of the last LED turned on

View Source
Declaration
public int GetTopLedForPercentage()
Returns

System.Int32

SetLed(int, bool)

Set the LED state

View Source
Declaration
public Task SetLed(int index, bool isOn)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.Int32indexIndex of the LED
System.BooleanisOnTrue for on, False for off

SetPercentage(float)

Set the percentage of LEDs that are on starting from index 0

View Source
Declaration
public Task SetPercentage(float percentage)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.SinglepercentagePercentage (Range from 0 - 1)