upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for the Grove Circular LED module. More...

Detailed Description

This is a circular LED ring based on the MY9221 chip. It is often used with a rotary encoder and has 24 controllable LEDs.

grovecircularled.jpg
// Instantiate a Grove Circular LED on D9 for data, D8 for clock
upm::GroveCircularLED circle(9, 8);
int level = 0;
while (shouldRun) {
circle.setSpinner(level);
level = (level + 1) % 24;
upm_delay_us(100000);
}

Public Member Functions

 GroveCircularLED (int dataPin, int clockPin)
 
virtual ~GroveCircularLED ()
 
void setSpinner (uint8_t position)
 
void setLevel (uint8_t level, bool direction=true)
 
- Public Member Functions inherited from MY9221
 MY9221 (int dataPin, int clockPin, int instances=1)
 
virtual ~MY9221 ()
 
void setAutoRefresh (bool enable)
 
void setLED (int led, bool on)
 
void setLowIntensityValue (int intensity)
 
void setHighIntensityValue (int intensity)
 
void setAll ()
 
void clearAll ()
 
void refresh ()
 

Additional Inherited Members

- Protected Attributes inherited from MY9221
my9221_context m_my9221
 

Constructor & Destructor Documentation

GroveCircularLED ( int  dataPin,
int  clockPin 
)

Instantiates an GroveCircularLED object

Parameters
dataPinData pin
clockPinClock pin

Here is the call graph for this function:

~GroveCircularLED ( )
virtual

GroveCircularLED destructor

Member Function Documentation

void setSpinner ( uint8_t  position)

Sets the spinner (turns off all LEDs but selected one)

Parameters
positionSelected position for the spinner (0-23)

Here is the call graph for this function:

void setLevel ( uint8_t  level,
bool  direction = true 
)

Sets the lighting status

Parameters
levelSelected level for the circular LED (0-23)
directionUp or down; up is true and default

Here is the call graph for this function:

Inheritance diagram for GroveCircularLED:
Inheritance graph
[legend]
Collaboration diagram for GroveCircularLED:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: