GroveLedBarMy9221 class
The Grove LED Bar MY9221 is comprised of a 10 segment LED gauge bar and an MY9221 LED controlling chip.
It can be used as an indicator for remaining battery life, voltage, water level, music volume or other values that require a gradient display.
There are 10 LED bars in the LED bar graph: one red, one yellow, one light green, and seven green bars.
An individual led is on or off dependent on its intensity value, initially values of 0 and 0xff are used for low and high intensity values. These can be set as you wish, with a high intensity value 0x7f being half the intensity of a 0xff value.
Constructors
- GroveLedBarMy9221(Mraa mraa, MraaGpioContext clockPin, MraaGpioContext dataPin)
- Construction
Properties
- autoRefresh ← bool
-
Auto refresh
no getter
- deviceContext → My9221Context?
-
The My9221 context
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- highIntensity ← int
-
Set high intensity
no getter
- lowIntensity ← int
-
Set low intensity
no getter
- maxLed → int?
-
Max led bars
no setter
-
monitored
→ GroveSequenceMonitor<
MraaReturnCode> -
Last monitored sequence status
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearAll(
) → void - Clear all Led's
-
close(
) → void - Close the GPIO pin contexts and the MY9221 context.
-
initialise(
) → bool - Initialise - must be called before use otherwise no commands will be sent to the device. Returns true if initialisation succeeded and is a monitored sequence.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
) → void - Refresh the display. This can be done automatically see autoRefresh. The device must be initialised.
-
setAll(
) → void - Set all Led's on
-
setLed(
int led, {bool on = false}) → void - Set and individual led on or off, note this will auto scale to the led range.
-
setLevel(
int level) → void - Set level (0-10) Level 0 means all leds off Level 10 means all leds on
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- ledPerInstance → const int
- Led bars per instance