Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added colors and moded some routines #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 113 additions & 27 deletions LoquaciousAndLovely2015.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@

int mode = 0;
int idx = 0;
int n_modes = 12;
int n_modes = 19;
int modes[] = { // C
// int modes[] = new int[] { // Java
600, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300
//int modes[] = new int[] { // Java
400, 250, 250, 250, 250, 200, // number of frames each mode goes for. Add here if
300, 300, 300, 300, 300, 600,
50, 50, 50, 50, 50, 400,600
};
uint32_t currentColor; // C
// color currentColor; // Java

int n_colors = 4;
int n_colors = 5;
byte colors[] = { // C
// int colors[] = new int[] { // Java
107,18,76, // Pink
32,112,104, // Turquoise

0,17,51, // Royal Blue
119,25,32 // Red
110,25,32, // Red
204,122,33 // Ochre
};

uint32_t color(byte r, byte g, byte b) { // C
Expand Down Expand Up @@ -105,6 +108,7 @@
for (int j=0; j<tailsize && step+j<=len/2; j++) {
if (step+j>=0) {
x = bound(offsets[i]+step+j, len);
// stepColor(byte r, byte g, byte b, int step, float divisor)
strips[i].setPixelColor(x,stepColor(127,127,127,j,tailsize));

x = bound(offsets[i]-step-j, len);
Expand All @@ -115,6 +119,8 @@
strips[i].show();
}
}



void colorBleed(int idx, int r, int g, int b, float div) {
int x;
Expand All @@ -126,6 +132,7 @@

for (int j=1; j<idx; j++) {
if (x+j<strips[i].numPixels())
//what is idx?
strips[i].setPixelColor(x+j, stepColor(r,g,b,idx-j,div));

if (x-j>=0)
Expand Down Expand Up @@ -172,30 +179,97 @@
}
}

void blinkyBlinky(int idx) {
for (int i = 0; i < 5 ; i++) {
for (int led = 0; led < strips[i].numPixels (); led++) {
if (idx % 6 < 3) {
strips[i].setPixelColor(led, color(255, 255, 255));
} else {
strips[i].setPixelColor(led, color(0, 0, 0));
// void blinkyBlinky(int idx, uint32_t col) { // C
void blinkyBlinky(int idx, int r, int g, int b, float div) { //Java
for (int strip = 0; strip < 5 ; strip++) {
for (int led = 0; led < strips[strip].numPixels (); led++) {
if ((idx % 30 >= 0) && (idx% 30 < 10 )) {
if (strip == 0) {
strips[strip].setPixelColor(led, stepColor(r,g,b,idx,div));
// strips[int(random(strip))].setPixelColor(led, col);
//delay(1);
} else {
strips[strip].setPixelColor(led, color(0, 0, 0));
}
} else if ((idx % 30 >= 10) && (idx% 30 <20)) {
if ((strip == 1) || (strip ==3)) {
strips[strip].setPixelColor(led, stepColor(r,g,b,idx,div));
} else {
strips[strip].setPixelColor(led, color(0, 0, 0));
}
}
else if ((idx % 30 >= 20) && (idx % 30 < 30)) {
if ((strip == 2) || (strip ==4))
strips[strip].setPixelColor(led, stepColor(r,g,b,idx,div));
} else {
strips[strip].setPixelColor(led, color(0, 0, 0));
}
}
strips[strip].show();
}
}

strips[i].show();

void blinkyBlinky2(int idx, uint32_t col) { // C
//void blinkyBlinky2(int idx, int r, int g, int b, float div) { //Java
for (int strip = 0; strip < 5 ; strip++) {
for (int led = 0; led < strips[strip].numPixels (); led++) {
if (idx % 24 <= 12 ) {
strips[strip].setPixelColor(led, col);
// strips[int(random(strip))].setPixelColor(led, col);
//delay(1);
} else {
strips[strip].setPixelColor(led, color(250, 0, 0));
}
}
strips[strip].show();
}
}
}

// void sparklySparkly(int idx) {
// for (int i = 0; i < 5; i++) {
// for (int led = 0; led < strips[i].numPixels(); led++) {
// if (idx % 32 == 0){
// if (random(5)> 3) {
// strips[i].setPixelColor(led, color(30, 30, 30));
// } else {
// strips[i].setPixelColor(led, color(0, 0, 0));
// }
// } else if ((idx % 32 > 0) && (idx % 32 <= 16)){
// for (float j = 0; j < 5; j++) {
// //if (random(3) > 2) {
// strips[i].setPixelColor(led, color( red(strips[i].getPixelColor(led))*(1+(j/10)),
// green(strips[i].getPixelColor(led))*(1+j/10),
// blue(strips[i].getPixelColor(led))*(1+j/10)));
//
// }
// } else if ((idx % 32 > 16) && (idx % 32 <= 32)){
// for (float j = 0; j < 5; j++) {
// //if (random(3) > 2) {
// strips[i].setPixelColor(led, color( red(strips[i].getPixelColor(led))/(1+(j/10)),
// green(strips[i].getPixelColor(led))/(1+j/10),
// blue(strips[i].getPixelColor(led))/(1+j/10)));
//
// }
// }
// }
// strips[i].show();
// }
// }

void sparklySparkly(int idx) {
if (idx % 4 == 0) {
for (int i = 0; i < 5; i++) {
for (int led = 0; led < strips[i].numPixels(); led++) {
if (random(3) > 2) strips[i].setPixelColor(led, color(127, 127, 127));
else strips[i].setPixelColor(led, color(0, 0, 0));
}
strips[i].show();
void sparklySparkly(int idx) {
for (int i = 0; i < 5; i++) {
for (int led = 0; led < strips[i].numPixels(); led++) {
if (idx % 32 == 0){
if (random(5)> 3) {
strips[i].setPixelColor(led, color(60, 60, 60));
} else {
strips[i].setPixelColor(led, color(0, 0, 0));
}
}
}
strips[i].show();
}
}

void clear() {
Expand All @@ -221,30 +295,42 @@

switch(mode) {
case 0:
// sparklySparkly(idx);
gallop(idx);
//rainbowWarp(idx);
break;
case 1:
case 2:
case 3:
case 4:
case 5:
colorBleed(idx, colors[(mode-1)*3], colors[(mode-1)*3+1], colors[(mode-1)*3+2], modes[mode] / 4.0);
break;
case 5:
case 6:
case 7:
case 8:
colorWipe(idx, color(colors[(mode-5)*3], colors[(mode-5)*3+1], colors[(mode-5)*3+2]));
break;
case 9:
case 10:
colorWipe(idx, color(colors[(mode-6)*3], colors[(mode-6)*3+1], colors[(mode-6)*3+2]));
break;
case 11:
rainbowWarp(idx);
break;
case 12:
case 13:
case 14:
case 15:
case 16:
blinkyBlinky(idx, colors[(mode-12)*3], colors[(mode-12)*3+1], colors[(mode-12)*3+2], modes[mode]/4.0);
break;
case 17:
// blinkyBlinky2(idx, color(colors[(mode-13)*3], colors[(mode-13)*3+1], colors[(mode-13)*3+2]));
blinkyBlinky2(idx, color(255,255,10));
break;
case 18:
sparklySparkly(idx);
break;
}

delay(10);
}