HOME | DD
Published: 2013-02-13 16:29:41 +0000 UTC; Views: 439; Favourites: 1; Downloads: 1
Redirect to original
Description
This is described in a journal entry. [link] It is a configurable light strip controller to make the light strip flicker, change colors, or whatever you want it to do. If you want to make one, this image should be sufficient to copy it.Note: This is slightly changed from the picture before, I have removed some unnecessary parts and moved around the arduino outputs.
The following program, for instance, will cycle through all the colors of the rainbow.
#define RED 9
#define GRN 10
#define BLU 11
void setup() {
// initialize the LED pins as outputs.
pinMode(RED, OUTPUT);
pinMode(GRN, OUTPUT);
pinMode(BLU, OUTPUT);
randomSeed (analogRead (0));
}
void rainbowAnimationSmooth (byte n) {
int i;
float r;
float fr, fg, fb;
byte lr, lg, lb;
for (i = 0; i < 126; i++) {
r = (float)i * 0.05;
fr = cos (r);
fg = cos (r - 2.1);
fb = cos (r - 4.2);
fr += 0.5;
fg += 0.5;
fb += 0.5;
lr = (fr > 0.0)? fr * (255.0 / 1.5) : 0;
lg = (fg > 0.0)? fg * (255.0 / 1.5) : 0;
lb = (fb > 0.0)? fb * (255.0 / 1.5) : 0;
analogWrite (RED, lr);
analogWrite (GRN, lg);
analogWrite (BLU, lb);
delay (n);
}
}
void loop() {
rainbowAnimationSmooth (30);
}



















