SHOHEI FUJIMOTO / Mbed 2 deprecated LineLedControl2

Dependencies:   EthernetNetIf LPD8806 mbed

Fork of OSCReceiver by Shigeki KOMATSU

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Control.cpp Source File

Control.cpp

00001 #include "mbed.h"
00002 #include "LPD8806.h"
00003 #include "Control.h"
00004 
00005 LPD8806 strip = LPD8806(30);
00006 
00007 // setup
00008 void LedControl::setup(int numberOfLed)
00009 {
00010 //    strip = LPD8806(numberOfLed);
00011 }
00012 
00013 // led pattren------------------------------------------------------
00014 
00015 void LedControl::colorChase(int r, int g, int b, uint8_t delay) {
00016     int i;
00017 
00018     for (i=0; i < strip.numPixels(); i++) {
00019         strip.setPixelColor(i, 0);  // turn all pixels off
00020     }
00021 
00022     for (i=0; i < strip.numPixels(); i++) {
00023         strip.setPixelColor(i, strip.Color(r,g,b));
00024         if (i == 0) {
00025             strip.setPixelColor(strip.numPixels()-1, 0);
00026         } else {
00027             strip.setPixelColor(i-1, 0);
00028         }
00029         strip.show();
00030         wait_ms(delay);
00031     }
00032 }