0,0 → 1,212 |
#include "LPD8806_kopterlight.h" |
#include "SPI.h" |
|
/*****************************************************************************/ |
// Kopter light control on LPD8806-based RGB LED Modules in a strip! |
/*****************************************************************************/ |
|
/*****************************************************************************/ |
// To be changed according to your setup |
// The LED strips are 40 LEDs per meter but you can extend/cut the strip |
|
#define rigger 4 // number of rigger (default: 4) |
#define riggerSize 10 // Pixels / LEDs per rigger (default: 10) |
|
#define stripSize (riggerSize*rigger) |
|
// Use only if Hardware SPI is not possible |
// int dataPin = 3; // Software SPI Data Pin |
// int clockPin = 2; // Software SPI Clock Pin |
// Soft SPI |
// LPD8806 strip = LPD8806(stripSize, dataPin, clockPin, rigger); |
|
// HW SPI |
// on Arduino 168/328 thats data = 11, and clock = pin 13 |
LPD8806 strip = LPD8806(stripSize, rigger); |
|
/*****************************************************************************/ |
//Do not change or remove these! |
void setup() { |
// Start up the LED strip |
strip.begin(); |
// Update the strip, to start they are all 'off' |
strip.show(); |
} |
|
/*****************************************************************************/ |
// Space for your light effects: |
/*****************************************************************************/ |
// Only inside Void Loop() you are allowed to design your light effects !! |
// ( If you like to program a new pattern or sequences, refer to sequences.ino) |
/*****************************************************************************/ |
// Parameter: Colors are defined by the additive RGB color model. |
// n = LED No on rigger |
// r = red ( max. 127) |
// g = green ( max. 127) |
// b = blue ( max. 127) |
// dly = delay ( typical: 10 - 50 ) |
// cyl = cyles ( how many times this sequence will repeat ) |
// riX = rigger to set pixel / to show sequence on x= number of rigger |
/*****************************************************************************/ |
void loop() { |
|
clearstrip (); |
|
// These are Examples of possible color pattern and sequences. |
|
// Set single LED on selected rigger: |
// setLED(n, r, g, b, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
setLED(1, 127, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(10, 127, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(10, 0, 127, 0, 0, 1, 0, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(1, 0, 127, 0, 0, 1, 0, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(1, 0, 0, 127, 0, 0, 1, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(10, 0, 0,127, 0, 0, 1, 0, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(10, 127, 127, 127, 0, 0, 0, 1, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(1, 127, 127, 127, 0, 0, 0, 1, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
setLED(5, 127, 52, 0, 1, 1, 1, 1, 0, 0, 0, 0); |
setLED(6, 127, 52, 0, 1, 1, 1, 1, 0, 0, 0, 0); |
strip.show(); |
delay(550); |
clearstrip (); |
strip.show(); |
delay(950); |
setLED(5, 127, 52, 0, 1, 1, 1, 1, 0, 0, 0, 0); |
setLED(6, 127, 52, 0, 1, 1, 1, 1, 0, 0, 0, 0); |
strip.show(); |
delay(950); |
clearstrip (); |
strip.show(); |
|
// Fade In Effect: |
// fadein(r, g, b, dly, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
fadein(127,14,0,10,1,0,1,0,0,0,0,0); |
|
// Fade Out Effect: |
// fadein(r,g,b,dly,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
fadeout(127,14,0,10,1,0,1,0,0,0,0,0); |
|
fadein(127,0,0,10,0,1,0,1,0,0,0,0); |
fadeout(127,0,0,10,0,1,0,1,0,0,0,0); |
fadein(47,127,00,5,1,0,0,0,0,0,0,0); |
fadein(47,127,00,5,0,1,0,0,0,0,0,0); |
fadein(47,127,00,5,0,0,1,0,0,0,0,0); |
fadein(47,127,00,5,0,0,0,1,0,0,0,0); |
fadeout(47,127,00,5,1,0,0,0,0,0,0,0); |
fadeout(47,127,00,5,0,1,0,0,0,0,0,0); |
fadeout(47,127,00,5,0,0,1,0,0,0,0,0); |
fadeout(47,127,00,5,0,0,0,1,0,0,0,0); |
fadein(0,0,127,2,1,0,0,0,0,0,0,0); |
fadein(0,0,127,2,0,0,0,1,0,0,0,0); |
fadein(0,0,127,2,0,0,1,0,0,0,0,0); |
fadein(0,0,127,2,0,1,0,0,0,0,0,0); |
fadeout(0,0,127,2,0,1,0,0,0,0,0,0); |
fadeout(0,0,127,2,0,0,1,0,0,0,0,0); |
fadeout(0,0,127,2,0,0,0,1,0,0,0,0); |
fadeout(0,0,127,2,1,0,0,0,0,0,0,0); |
|
// Flashing Light Effect ( yellow-orange ) |
// flashLight(dly,cyl,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
flashLight(100,3,1,1,1,1,0,0,0,0); |
flashLight(100,3,1,0,1,0,0,0,0,0); |
flashLight(100,3,0,1,0,1,0,0,0,0); |
|
// Police Light Effect ( green & orange ) |
// police(dly,cyl,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8); |
police(110,3,1,0,0,0,0,0,0,0); |
police(110,3,0,1,0,0,0,0,0,0); |
police(110,3,0,0,1,0,0,0,0,0); |
police(110,3,0,0,0,1,0,0,0,0); |
police(110,3,1,0,1,0,0,0,0,0); |
police(110,3,0,1,0,1,0,0,0,0); |
police(110,3,0,0,1,1,0,0,0,0); |
police(110,3,1,1,0,0,0,0,0,0); |
police(110,3,0,1,1,0,0,0,0,0); |
police(110,3,1,0,0,1,0,0,0,0); |
police(110,3,1,1,1,1,0,0,0,0); |
|
// Circling Lights Effect ( red & blue ) |
// circlinglights(dly,cyl,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8); |
circlinglights(40,3,1,1,1,1,0,0,0,0); |
circlinglights(40,3,1,0,0,0,0,0,0,0); |
circlinglights(40,3,0,1,0,0,0,0,0,0); |
circlinglights(40,3,0,0,1,0,0,0,0,0); |
circlinglights(40,3,0,0,0,1,0,0,0,0); |
|
// Send a simple pixel chase in... |
// colorChase(r,g,b,dly,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
colorChase(127,127,127,80,1,0,0,0,0,0,0,0); // white |
|
// colorChaseRev(r,g,b,dly,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
colorChaseRev(127,0,0,80,0,1,0,0,0,0,0,0); // red |
|
colorChase(127,127,0,80,0,0,1,0,0,0,0,0); // yellow |
colorChaseRev(0,127,0,80,0,0,0,1,0,0,0,0); // green |
colorChase(0,127,127,80,1,0,1,0,0,0,0,0); // cyan |
colorChaseRev(0,0,127,80,0,1,0,1,0,0,0,0); // blue |
colorChase(127,0,127,80,1,1,1,1,0,0,0,0); // magenta |
|
// Fill the entire strip with... |
// colorWipe(r,g,b,dly,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
colorWipe(0,0,127,30,1,0,0,0,0,0,0,0); // blue |
colorWipe(127,0,43,30,0,1,0,0,0,0,0,0); // vibrant purple |
colorWipe(4,127,55,30,0,0,1,0,0,0,0,0); // vibrant green |
colorWipe(127,50,0,30,0,0,0,1,0,0,0,0); // orange |
colorWipe(0,0,0,30,1,1,1,1,0,0,0,0); // black |
|
// Color sparkles |
dither(0,127,127, 70,1,0,1,0,0,0,0,0); // cyan, slow |
dither(0,0,0, 70,1,0,1,0,0,0,0,0); // black, fast |
dither(127,0,127, 70,1,1,1,1,0,0,0,0); // magenta, slow |
dither(0,0,0, 70,1,1,1,1,0,0,0,0); // black, fast |
dither(127,127,0, 70,0,1,0,1,0,0,0,0); // yellow, slow |
dither(0,0,0, 70,0,1,0,1,0,0,0,0); // black, fast |
|
// Back-and-forth lights |
// scanner(r,g,b,dly,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
scanner(127,52,0, 50,1,0,0,0,0,0,0,0); // orange, fast |
scanner(127,0,0, 50,0,0,1,0,0,0,0,0); // red, slow |
scanner(0,0,127, 50,0,1,0,1,0,0,0,0); // blue, medium |
|
// Wavy ripple effects |
// wave(r,g,b,dly, stp, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
wave(127,0,0, 50, 4,1,0,1,0,0,0,0,0); // candy |
clearstrip (); |
wave(0,0,127, 50, 3,0,1,0,1,0,0,0,0); // icy |
clearstrip (); |
wave(0,127,0, 50, 2,1,0,1,0,0,0,0,0); // nature |
clearstrip (); |
|
// make a pretty rainbow cycle! |
// rainbowCycle(dly, cyl, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8) |
rainbowCycle(0,3,1,0,0,0,0,0,0,0); // make it go through the cycle fairly fast |
rainbowCycle(0,3,1,0,1,0,0,0,0,0); // make it go through the cycle fairly fast |
clearstrip (); |
rainbowCycle(0,3,0,1,0,1,0,0,0,0); // make it go through the cycle fairly fast |
rainbowCycle(0,8,1,1,1,1,0,0,0,0); // make it go through the cycle fairly fast |
|
|
|
|
} |
/*****************************************************************************/ |
|
|
|
|