upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions

API for MY9221-based LED Bars. More...

Detailed Description

This module defines the MY9221 interface for libmy9221

my9221.jpg
upm::MY9221 *bar = new upm::MY9221(8, 9);
signal(SIGINT, sig_handler);
while (!running) {
for (int idx = 1; idx < 11; idx++) {
bar->setBarLevel (idx);
usleep(1000);
}
}
// Instantiate a MY9221, we use D2 for the data, and D3 for the
// data clock. This was tested with a Grove LED bar.
upm::MY9221* bar = new upm::MY9221(2, 3);
while (shouldRun)
{
// count up from green to red
for (int i=1; i<=10; i++)
{
bar->setBarLevel(i, true);
usleep(50000);
}
sleep(1);
// count down from red to green
for (int i=1; i<=10; i++)
{
bar->setBarLevel(i, false);
usleep(50000);
}
sleep(1);
}

Public Member Functions

 MY9221 (uint8_t di, uint8_t dcki)
 
mraa::Result setBarLevel (uint8_t level, bool direction=true)
 
std::string name ()
 

Constructor & Destructor Documentation

MY9221 ( uint8_t  di,
uint8_t  dcki 
)

Instantiates an MY9221 object

Parameters
diData pin
dckiClock pin

Member Function Documentation

mraa::Result setBarLevel ( uint8_t  level,
bool  direction = true 
)

Sets the bar level

Parameters
levelSelected level for the bar (1 - 10)
directionUp or down; up is true and default
std::string name ( )
inline

Returns the name of the component


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