upm  0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
Public Member Functions

C++ API for MY9221 led bar module. More...

Detailed Description

This file defines the MY9221 C++ 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)
 
 ~MY9221 ()
 
mraa_result_t setBarLevel (uint8_t level, bool direction=true)
 
std::string name ()
 

Constructor & Destructor Documentation

MY9221 ( uint8_t  di,
uint8_t  dcki 
)

Instanciates a MY9221 object

Parameters
didata pin
dckiclock pin
~MY9221 ( )

MY9221 object destructor

Member Function Documentation

mraa_result_t setBarLevel ( uint8_t  level,
bool  direction = true 
)

Set the level bar

Parameters
levelselected level for the bar (1 - 10)
directionup or down, true is up and is the default
std::string name ( )
inline

Return name of the component


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