Hi, Thanks for looking at my code. I originally sent only a portion of the code as I was hoping the problem was obvious and I could spare you the gory details. I should know better as the devil is in the details, isn't it.
The circuit is a simple string of 10 neo-pixels connected to pin 6 of a Flora. They go behind some flowers; hence, the flower names. The color of every neo-pixel is white. I want the entire string to be constantly lit to half brightness. Then I want to randomly choose
5 neo-pixels to fade up to full brightness, remain there for 5 seconds, then fade back down to half brightness. Once this is done I want to randomly choose another group of
5 neo-pixels to do the same as the first group. Fade from half to full brightness. Stay at full for 5 seconds. Fade back down to half. Then looping back to the beginning.
I have been learning my code from your tutorials, Multi-Tasking The Arduino-Part 1
.
I have gone from using delay() commands to using timing with millis(). I have learned how to use a switch statement and how to create functions all in the past week. I, ultimately, intend to replace the fade algorithm with a fade function but that is not the case in this code.
You might wonder why I use (32,32,32) for my half-bright white r,g,b instead of (127,127,127). I refer you to the table in your tutorial on Led Tricks and Gamma correction
So there are alot of random variables in the code. First, I randomly choose the number of neo-pixels to bring up to full brightness. Then I set up a switch stmnt related to the random number chosen, either switch(m) or switch(n) in my code. I randomly choose the number of each neo-pixel to be lit and use a do while loop to ensure that the same neo-pixel is not chosen twice with the group. Variables a-e are related with switch(m). Variables v-z are related to switch(n). I think this is the most complicated part of the program.
After I create the random variables, I use a switch statement, either switch(m) or switch(n), to determine which case to use based on the random number of neo-pixels chosen to be lit.
I use a for loop to accomplish the fade.
I use 1000 TotalSteps to go through the Fade cycle.
I nest another for loop inside the first to initialize all the neo-pixels in the strip to half-bright white.
I use the algorithm presented in the Multi-Tasking tutorial Part 3 to obtain the r,g,b values for the fade, half-bright (32,32,32) being Color1, and full-bright (255,255,255) being Color2. Then I use the random variable numbers generated for the a-e group( switch(m)), or the v-z group(switch(n)) to initialize the neo-pixels with the calculated r,g,b values.
I then light the neo-pixel strip using strip_Flower.show(). I do this inside a do while loop that counts 5 milliseconds before performing the next iteration of the fade cycle.
As I said earlier, everything works great. The neo-pixels are randomly chosen correctly. The switch statements execute the correct case. The lights fade up nicely, except that they do it 4 times. The neo-pixels stay lit at full-bright for the correct amount of time, 5 seconds, and they do it only once as they are supposed to. They then fade back down to half-bright, once again doing it 4 times.
Everything in the program seems to perform correctly except for the neo-pixels that are initialized by the fade algorithm, and there it repeats only 4 times. If it was a problem with the for loop I would expect it to repeat 1000 times. I hope you can figure it out. Thanks.
Code: Select all
#include <Adafruit_NeoPixel.h>
const int NEOPIN_Flower = 6;
const int colorInterval = 4;
int NUMNEOPIXEL_Flower = 10;
int TotalSteps = 1000;
int IndexFL = 0;
float red = 0; // I use floats to avoid truncating the variables
float green = 0;
float blue = 0;
unsigned long currentMillis_Color = 0;
unsigned long previousMillis_Color = 0;
unsigned long previousMillis_Flower = 0;
unsigned long currentMillis_Flower = 0;
Adafruit_NeoPixel strip_Flower = Adafruit_NeoPixel(NUMNEOPIXEL_Flower, NEOPIN_Flower, NEO_RGB +
NEO_KHZ800);
void setup()
{
strip_Flower.begin();
}
void loop()
{
int i=0;
int m=0;
int a=9; // I originally envisioned a situation where if all the variables were zero it might create an endless loop in my code, but I'm not sure.
int b=8;
int c=7;
int d=6;
int e=5;
int n=0;
int v=4;
int w=3;
int x=2;
int y=1;
int z=0;
int IndexFL = 0;
m =random(0,5);
switch(m)
{
case 0:
a =random(0,10);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(a,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 1:
a =random(0,10);
do
{ b = random(0,10);
}
while (b==a);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(a,255,255,255);
strip_Flower.setPixelColor(b,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 2:
a =random(0,10);
do
{ b = random(0,10);
}
while (b==a);
do
{c = random(0,10);
}
while (c==a||c==b);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(a,255,255,255);
strip_Flower.setPixelColor(b,255,255,255);
strip_Flower.setPixelColor(c,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 3:
a =random(0,10);
do
{ b = random(0,10);
}
while (b==a);
do
{c = random(0,10);
}
while (c==a||c==b);
do
{d = random(0,10);
}
while (d==a||d==b||d==c);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
strip_Flower.setPixelColor(d,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(a,255,255,255);
strip_Flower.setPixelColor(b,255,255,255);
strip_Flower.setPixelColor(c,255,255,255);
strip_Flower.setPixelColor(d,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
strip_Flower.setPixelColor(d,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 4:
a =random(0,10);
do
{ b = random(0,10);
}
while (b==a);
do
{c = random(0,10);
}
while (c==a||c==b);
do
{d = random(0,10);
}
while (d==a||d==b||d==c);
do
{e = random(0,10);
}
while (e==a||e==b||e==c||e==d);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
strip_Flower.setPixelColor(d,red,green,blue);
strip_Flower.setPixelColor(e,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(a,255,255,255);
strip_Flower.setPixelColor(b,255,255,255);
strip_Flower.setPixelColor(c,255,255,255);
strip_Flower.setPixelColor(d,255,255,255);
strip_Flower.setPixelColor(e,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(a,red,green,blue);
strip_Flower.setPixelColor(b,red,green,blue);
strip_Flower.setPixelColor(c,red,green,blue);
strip_Flower.setPixelColor(d,red,green,blue);
strip_Flower.setPixelColor(e,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
}
n = random(0,5);
switch(n)
{
case 0:
v =random(0,10);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(v,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 1:
v =random(0,10);
do
{ w = random(0,10);
}
while (w==v);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(v,255,255,255);
strip_Flower.setPixelColor(w,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 2:
v =random(0,10);
do
{ w = random(0,10);
}
while (w==v);
do
{x = random(0,10);
}
while (x==v||x==w);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(v,255,255,255);
strip_Flower.setPixelColor(w,255,255,255);
strip_Flower.setPixelColor(x,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 3:
v =random(0,10);
do
{ w = random(0,10);
}
while (w==v);
do
{x = random(0,10);
}
while (x==v||x==w);
do
{y = random(0,10);
}
while (y==v||y==w||y==x);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
strip_Flower.setPixelColor(y,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(v,255,255,255);
strip_Flower.setPixelColor(w,255,255,255);
strip_Flower.setPixelColor(x,255,255,255);
strip_Flower.setPixelColor(y,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
strip_Flower.setPixelColor(y,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
case 4:
v =random(0,10);
do
{ w = random(0,10);
}
while (w==v);
do
{x = random(0,10);
}
while (x==v||x==w);
do
{y = random(0,10);
}
while (y==v||y==w||y==x);
do
{z = random(0,10);
}
while (z==v||z==w||z==x||z==y);
for(IndexFL = 0; IndexFL<TotalSteps; IndexFL ++)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
strip_Flower.setPixelColor(y,red,green,blue);
strip_Flower.setPixelColor(z,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
strip_Flower.setPixelColor(v,255,255,255);
strip_Flower.setPixelColor(w,255,255,255);
strip_Flower.setPixelColor(x,255,255,255);
strip_Flower.setPixelColor(y,255,255,255);
strip_Flower.setPixelColor(z,255,255,255);
strip_Flower.show();
currentMillis_Flower = 0;
previousMillis_Flower = millis();
do
{
currentMillis_Flower = (millis() - previousMillis_Flower);
}
while (currentMillis_Flower <5000);
for(IndexFL=999; IndexFL >= 0; IndexFL --)
{
for(i=0; i< NUMNEOPIXEL_Flower; i++)
{
strip_Flower.setPixelColor(i,32,32,32);
}
red =((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
green = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
blue = ((32 * (TotalSteps-IndexFL)) + (255*IndexFL)) / TotalSteps;
strip_Flower.setPixelColor(v,red,green,blue);
strip_Flower.setPixelColor(w,red,green,blue);
strip_Flower.setPixelColor(x,red,green,blue);
strip_Flower.setPixelColor(y,red,green,blue);
strip_Flower.setPixelColor(z,red,green,blue);
previousMillis_Flower = millis();
do
{
strip_Flower.show();
}
while ((millis() - previousMillis_Flower) <10);
}
break;
}
}