upm  1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
GroveLed Class Reference

API for the Grove LED. More...

Detailed Description

UPM module for the Grove LED (or other similar light-emitting diodes). An LED is a small lightbulb that emits light in response to a small current. The longer wire of an LED connects to the positive seat (anode); the shorter wire connects to the negative seat (cathode). The flat side of the bulb corresponds to the cathode, while the rounded side corresponds to the anode.

// Create the Grove LED object using GPIO pin 2
// Print the name
std::cout << led->name() << std::endl;
// Turn the LED on and off 10 times, pausing one second
// between transitions
for (int i=0; i < 10; i++) {
// Delete the Grove LED object
delete led;
// Instantiate a grove LED on D2. Here we are controlling a Grove
// Multi-color flash LED. We just just need to turn it on - it will
// then cycle through various colors (red, green, blue, purple) on it's
// own until turned off.
// start the light show
// just sleep until interrupted
while (shouldRun)

Public Member Functions

 GroveLed (int pin)
 ~GroveLed ()
mraa_result_t write (int value)
mraa_result_t off ()
mraa_result_t on ()
- Public Member Functions inherited from Grove
std::string name ()

Additional Inherited Members

- Protected Attributes inherited from Grove
std::string m_name

Constructor & Destructor Documentation

GroveLed ( int  pin)

Grove LED constructor

pinPin to use
~GroveLed ( )

Grove LED destructor

Member Function Documentation

mraa_result_t write ( int  value)

Turns the LED on or off, depending on the value. If the value is positive (greater than or equal to 1), the LED is turned on. Otherwise, for 0 or negative values, the LED is turned off.

valueTells the LED to turn on (for values >=1) or off (for values <1)
0 if successful, non-zero otherwise

Here is the caller graph for this function:

mraa_result_t off ( )

Turns the LED off

0 if successful, non-zero otherwise

Here is the call graph for this function:

mraa_result_t on ( )

Turns the LED on

0 if successful, non-zero otherwise

Here is the call graph for this function:

Inheritance diagram for GroveLed:
Inheritance graph
Collaboration diagram for GroveLed:
Collaboration graph

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