![](/media/cache/profiles/531a7a573b64cf81c7dfbdbfe8ab8c6f.jpg.50x50_q85.jpg)
LineLedControl
Dependencies: EthernetNetIf LPD8806 mbed
Fork of OSCReceiver by
Diff: LedControl/Control.cpp
- Revision:
- 1:e0714e1a1568
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LedControl/Control.cpp Mon Aug 26 17:22:36 2013 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "LPD8806.h" +#include "Control.h" + +LPD8806 strip = LPD8806(30); + +// setup +void LedControl::setup(int numberOfLed) +{ +// strip = LPD8806(numberOfLed); +} + +// led pattren------------------------------------------------------ + +void LedControl::colorChase(int r, int g, int b, uint8_t delay) { + int i; + + for (i=0; i < strip.numPixels(); i++) { + strip.setPixelColor(i, 0); // turn all pixels off + } + + for (i=0; i < strip.numPixels(); i++) { + strip.setPixelColor(i, strip.Color(r,g,b)); + if (i == 0) { + strip.setPixelColor(strip.numPixels()-1, 0); + } else { + strip.setPixelColor(i-1, 0); + } + strip.show(); + wait_ms(delay); + } +} \ No newline at end of file