Basic RGB library for non-PWM LEDs

Dependents:   MenuExample exosite_http_example exosite_http_example FastPWM

Warning : Works with non-PWM LED (0 or 1).

A quick example on how to use it.

#include "mbed.h"
#include "RGBLed.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);
    }
}

Files at this revision

API Documentation at this revision

Comitter:
rominos2
Date:
Tue Sep 02 21:34:05 2014 +0000
Parent:
0:0969a9e32945
Child:
2:3c0889914cb2
Commit message:
API Documentation Update

Changed in this revision

rgb.h Show annotated file Show diff for this revision Revisions of this file
--- a/rgb.h	Tue Sep 02 13:05:51 2014 +0000
+++ b/rgb.h	Tue Sep 02 21:34:05 2014 +0000
@@ -1,9 +1,8 @@
 #include "mbed.h"
 
-/** 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.
+/** A  light RGB LED Class \n
+    Warning : This library is for non-PWN LED \n
+    Here is an quick hello-world class that makes the LED blink with all colors. \n
     @code
     #include "mbed.h"
     #include "rgb.h"
@@ -29,7 +28,7 @@
     DigitalOut _blue;
         
 public:
-    /* RGB Color class
+    /** RGB Color class \n
     Colors have been defined and are ready to use in RGB class
     */
     class Color {