I had figured this out on a previous project for halloween, but I lost my original code and now Im banging my head on how I figured it out before.

I have LPD8806 strip of LEDS. I want to get the "pulse" effect, where the entire strip goes on and off via the Sine wave.. nice smooth transition.

The Wave effect does this, but it passes through the entire strip. I just want to modify it to do the same for every LED at the same time. I'm fairly certain that I did a simple modification to the Wave function to do this the last time. If i didnt, its probably why Im not figuring this out.

// Sine wave effect

#define PI 3.14159265

void wave(uint32_t c, int cycles, uint8_t wait) {

float y;

byte r, g, b, r2, g2, b2;

// Need to decompose color into its r, g, b elements

g = (c >> 16) & 0x7f;

r = (c >> 8) & 0x7f;

b = c & 0x7f;

for(int x=0; x<(strip.numPixels()*5); x++)

{

for(int i=0; i<strip.numPixels(); i++) {

y = sin(PI * (float)cycles * (float)(x + i) / (float)strip.numPixels());

if(y >= 0.0) {

// Peaks of sine wave are black

y = 1.0 - y; // Translate Y to 0.0 (top) to 1.0 (center)

r2 = (byte)((float)r * y);

g2 = (byte)((float)g * y);

b2 = (byte)((float)b * y);

} else {

// Troughs of sine wave are black

y += 1.0; // Translate Y to 0.0 (bottom) to 1.0 (center)

r2 = (byte)((float)r * y);

g2 = (byte)((float)g * y);

b2 = (byte)((float)b * y);

}

strip.setPixelColor(i, r2, g2, b2);

}

strip.show();

delay(wait);

}

}

This post is my last resort before I let this tiny thing make me go crazy.

Help?