Example using Grove - Chainable RGB LED
Dependencies: Chainable_RGB_LED mbed
Fork of Seeed_Grove_Chainable_RGB_LED_Example by
main.cpp@0:74eac9e7f286, 2014-08-22 (annotated)
- Committer:
- yihui
- Date:
- Fri Aug 22 08:00:42 2014 +0000
- Revision:
- 0:74eac9e7f286
inital
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 0:74eac9e7f286 | 1 | #include "mbed.h" |
yihui | 0:74eac9e7f286 | 2 | #include "ChainableLED.h" |
yihui | 0:74eac9e7f286 | 3 | |
yihui | 0:74eac9e7f286 | 4 | // ChainableLED(clk, data, number_of_leds) |
yihui | 0:74eac9e7f286 | 5 | ChainableLED color_led(P1_14, P1_13, 1); |
yihui | 0:74eac9e7f286 | 6 | |
yihui | 0:74eac9e7f286 | 7 | int main() { |
yihui | 0:74eac9e7f286 | 8 | uint8_t value = 0; |
yihui | 0:74eac9e7f286 | 9 | |
yihui | 0:74eac9e7f286 | 10 | while(1) { |
yihui | 0:74eac9e7f286 | 11 | value++; |
yihui | 0:74eac9e7f286 | 12 | // ChainableLED.setColorRGB(index_of_led, red, green, blue) |
yihui | 0:74eac9e7f286 | 13 | color_led.setColorRGB(0, value, 255 - value, value + 80); |
yihui | 0:74eac9e7f286 | 14 | wait_ms(10); |
yihui | 0:74eac9e7f286 | 15 | } |
yihui | 0:74eac9e7f286 | 16 | } |