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);
    }
}
Revision:
2:3c0889914cb2
Parent:
0:0969a9e32945
--- a/rgb.cpp	Tue Sep 02 21:34:05 2014 +0000
+++ b/rgb.cpp	Tue Sep 02 21:55:22 2014 +0000
@@ -4,13 +4,13 @@
 }
 
 RGB::RGB(PinName redPin, PinName greenPin, PinName bluePin) : _red(redPin), _green(greenPin), _blue(bluePin) {
-    this->setColor(&RGB::BLACK); // Clear the LED output
+    this->setColor(RGB::BLACK); // Clear the LED output
 }
 
-void RGB::setColor(Color* color) {
-    _red = color->_r;
-    _green = color->_g;
-    _blue = color->_b;
+void RGB::setColor(Color& color) {
+    _red = color._r;
+    _green = color._g;
+    _blue = color._b;
 }
 
 RGB::Color RGB::BLACK = RGB::Color(1,1,1);