Nested Loop for neopixels

Hi,

I'm trying to create a loop to fade two neopixels, one UP and another DOWN at the 'same'ish' time, with a slight delay between each jump.

I had it working fine with one FOR loop but when I try to nest them it only works for the second FOR statement.

Assuming I have the structure wrong or maybe shouldn't even be using a nested FOR loop? Tried moving the strip.setPixelColor(2,y,y,y); in between the FOR statements but that didnt work either.... Help anyone?

void SunRise() {

for (int x = 255; x > 0; x--) { //Fades Down
for (int y = 255; y > 0; y++) { //Fades UP
strip.setPixelColor(1,x,x,x);
strip.setPixelColor(2,y,y,y);
strip.show();
delay(30);

}
}
}

No.. won't work.

try one for loop with int i, going from zero to 255 then..

calculate x & y as a function of your loop counter i..
x = 255-i;
y = i;
strip.setPixelColor(1,x,x,x);
strip.setPixelColor(2,y,y,y);

see if that works.

-jim lee

see if that works.

you know it does !

Well thank you!

-jim lee