#include "LPD8806.h" #include "SPI.h" // Example to control LPD8806-based RGB LED Modules in a strip! int dataPin = 2; int clockPin = 3; // Set the first variable to the NUMBER of pixels. 32 = 32 pixels in a row // The LED strips are 32 LEDs per meter but you can extend/cut the strip LPD8806 strip = LPD8806(32, dataPin, clockPin); void setup() { // Start up the LED strip strip.begin(); // Update the strip, to start they are all 'off' strip.show(); randomSeed(analogRead(A0)); } void loop() { for(int j=0; j < random(100,200); j++ ) { int i = random(0,strip.numPixels()-2) + 1; strip.setPixelColor(i-1, 4,0,8); strip.setPixelColor(i, 127,127,127); strip.setPixelColor(i+1, 4,0,8); strip.show(); delay(5); strip.setPixelColor(i-1, 0,0,0); strip.setPixelColor(i, 0,0,0); strip.setPixelColor(i+1, 0,0,0); strip.show(); delay(random(10,100)); } for(int j=0; j < random(1,5); j++ ) { for (int i=0; i < strip.numPixels(); i++) { strip.setPixelColor(i, 127,127,127); } strip.show(); delay(15); for (int i=0; i < strip.numPixels(); i++) { strip.setPixelColor(i, 0,0,0); } strip.show(); delay(150); } }
Recent Comments