example of Grove - Chainable RGB LED

Dependencies:   Chainable_RGB_LED mbed USBDevice

Committer:
yihui
Date:
Tue Oct 15 09:42:36 2013 +0000
Revision:
0:71564ae5e242
Child:
1:10700868060f
inital, example of Grove - Chainable RGB LED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 0:71564ae5e242 1 #include "mbed.h"
yihui 0:71564ae5e242 2 #include "ChainableLED.h"
yihui 0:71564ae5e242 3
yihui 0:71564ae5e242 4 DigitalOut led(LED4);
yihui 0:71564ae5e242 5 // ChainableLED(clk, data, number_of_leds)
yihui 0:71564ae5e242 6 ChainableLED color_led(P1_14, P1_13, 1);
yihui 0:71564ae5e242 7
yihui 0:71564ae5e242 8 int main() {
yihui 0:71564ae5e242 9 uint8_t value = 0;
yihui 0:71564ae5e242 10
yihui 0:71564ae5e242 11 while(1) {
yihui 0:71564ae5e242 12 value += 10;
yihui 0:71564ae5e242 13 // ChainableLED.setColorRGB(index_of_led, red, green, blue)
yihui 0:71564ae5e242 14 color_led.setColorRGB(0, value, 0xFF - value, 0);
yihui 0:71564ae5e242 15 led = !led;
yihui 0:71564ae5e242 16 wait(0.4);
yihui 0:71564ae5e242 17 }
yihui 0:71564ae5e242 18 }
yihui 0:71564ae5e242 19