my version of the RGBLed library. NOTHING changed, just wanted to put into my account.

Fork of RGBLed by Romain Berrada

Embed: (wiki syntax)

« Back to documentation index

RGBLed Class Reference

A light RGB LED Class
Warning : This library is for non-PWN LED
Here is an quick hello-world class that makes the LED blink with all colors. More...

#include <RGBLed.h>

Data Structures

class  Color
 RGB Color class
Colors have been defined and are ready to use in RGBLed class. More...

Public Member Functions

 RGBLed (PinName redPin, PinName greenPin, PinName bluePin)
 Create a RGBLed, containing the informations about the LED pinout.
void setColor (RGBLed::Color &color)
 Change the color of the LED.

Static Public Attributes

static Color BLACK = RGBLed::Color(1,1,1)
 Black Color (no color)
static Color RED = RGBLed::Color(0,1,1)
 Red Color.
static Color GREEN = RGBLed::Color(1,0,1)
 Green Color.
static Color BLUE = RGBLed::Color(1,1,0)
 Blue Color.
static Color MAGENTA = RGBLed::Color(0,1,0)
 Magenta Color (Red + Blue)
static Color CYAN = RGBLed::Color(1,0,0)
 Cyan Color (Green + Blue)
static Color YELLOW = RGBLed::Color(0,0,1)
 Yellow Color (Red + Green)
static Color WHITE = RGBLed::Color(0,0,0)
 White Color (Red + Green + Blue)

Detailed Description

A light RGB LED Class
Warning : This library is for non-PWN LED
Here is an quick hello-world class that makes the LED blink with all colors.


    #include "mbed.h"
    #include "RGBLed.h"     //was -> #include "rgb.h"


    RGBLed led(LED_RED, LED_GREEN, LED_BLUE);

    int main() {
        RGBLed::Color list[8] = {RGBLed::BLACK, RGBLed::RED, RGBLed::GREEN, RGBLed::BLUE, RGBLed::MAGENTA, RGBLed::CYAN, RGBLed::YELLOW, RGBLed::WHITE};
        int i = 0;

        while (true) {
            i = (i+1)%8;
            led.setColor(list[i]);
            wait_ms(100);
        }
    }

Definition at line 47 of file RGBLed.h.


Constructor & Destructor Documentation

RGBLed ( PinName  redPin,
PinName  greenPin,
PinName  bluePin 
)

Create a RGBLed, containing the informations about the LED pinout.

Parameters:
redPinthe pin linked to the Red LED
greenPinthe pin linked to the green LED
bluethe pin linked to the blue LED

Definition at line 25 of file RGBLed.cpp.


Member Function Documentation

void setColor ( RGBLed::Color color )

Change the color of the LED.

Parameters:
colorthe color to display
See also:
RGBLed::Color

Definition at line 29 of file RGBLed.cpp.


Field Documentation

RGBLed::Color BLACK = RGBLed::Color(1,1,1) [static]

Black Color (no color)

Definition at line 79 of file RGBLed.h.

RGBLed::Color BLUE = RGBLed::Color(1,1,0) [static]

Blue Color.

Definition at line 82 of file RGBLed.h.

RGBLed::Color CYAN = RGBLed::Color(1,0,0) [static]

Cyan Color (Green + Blue)

Definition at line 84 of file RGBLed.h.

RGBLed::Color GREEN = RGBLed::Color(1,0,1) [static]

Green Color.

Definition at line 81 of file RGBLed.h.

RGBLed::Color MAGENTA = RGBLed::Color(0,1,0) [static]

Magenta Color (Red + Blue)

Definition at line 83 of file RGBLed.h.

RGBLed::Color RED = RGBLed::Color(0,1,1) [static]

Red Color.

Definition at line 80 of file RGBLed.h.

RGBLed::Color WHITE = RGBLed::Color(0,0,0) [static]

White Color (Red + Green + Blue)

Definition at line 86 of file RGBLed.h.

RGBLed::Color YELLOW = RGBLed::Color(0,0,1) [static]

Yellow Color (Red + Green)

Definition at line 85 of file RGBLed.h.