Here are a few functions for ya that I wrote for a LPD8806 project....but you will need to remove references to digitalRead(button) and butPush as these are used to detect a button press and change modes.
void music(int all){
micLevel = ((analogRead(A0)+analogRead(A2)))%1024; //read the pot value and add it to the microphone value to allow color shifting
if (digitalRead(button)) butPush = 1; //Was the button pushed to change modes?
//colorLevel = (micLevel%768)/2;
colorLevel = micLevel%384; //adjust colorLevel with the color wheel spectrum
numLeds = map(micLevel,200,600,0,stripSize); //Adjust adjust the most use of LEDs
if (all) numLeds = stripSize;
for (int i = 0; i < numLeds; i++){
strip.setPixelColor(i, Wheel((i+colorLevel)%384));
}
delay(map(analogRead(A1),0,1024,0,250));
strip.show();
for (int i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0); // turn all pixels off
}
if (digitalRead(button)) butPush = 1; //Was the button pushed to change modes?
}
void xmas(int dly){
int color=0;
while (butPush==0){
for (int i=0; i<stripSize; i++){
if (digitalRead(button)==1) {butPush=1; i=stripSize;}
if (color==4){
strip.setPixelColor(i,127,127,127); //white
}
else if (color==3){
strip.setPixelColor(i,127,90,0); //yellow
}
else if (color==2){
strip.setPixelColor(i,0,0,127); //blue
}
else if (color==1){
strip.setPixelColor(i,0,127,0); //green
}
else {
strip.setPixelColor(i,127,0,0); //red
}
if (color++==4) color=0;
}
if (butPush==0){
strip.show();
delay(dly);
}
}
}
void rand2(int dly){
//turn on lights one at a time with the same random color
//ensure that a light is turned on each cycle
//then turn off the lights 2 at a time
int lights[stripSize];
for (int i=0; i<stripSize; i++) lights[i]=0;
while (digitalRead(button)==0){
int red = random()%128;
int green = random()%128;
int blue = random()%128;
for (int i = 0; i < stripSize; i++){
int turnon=0;
while (turnon==0){
if (digitalRead(button)==1) {i=stripSize; butPush=1;}
int x = random()%stripSize;
if (lights[x]==0){
turnon=1;
lights[x]=1;
strip.setPixelColor(x,red,green,blue);
strip.show();
}
}
if (butPush==0) delay(dly);
}
if (butPush==0) delay(2000);
for (int i = 0; i < stripSize; i++){
int turnoff=1;
while (turnoff==1){
if (digitalRead(button)==1) {i=stripSize; butPush=1;}
int x = random()%stripSize;
if (lights[x]==1){
turnoff=0;
lights[x]=0;
strip.setPixelColor(x,0,0,0);
strip.show();
}
}
if (butPush==0) delay(dly);
}
}
}
void circlinglights(int dly){
int b=0;
int r=63;
while (digitalRead(button)==0){
strip.setPixelColor(b,0,0,2);
strip.setPixelColor((b+1)%stripSize,0,0,9);
strip.setPixelColor((b+2)%stripSize,0,0,16);
strip.setPixelColor((b+3)%stripSize,0,0,40);
strip.setPixelColor((b+4)%stripSize,0,0,55);
strip.setPixelColor((b+5)%stripSize,0,0,80);
strip.setPixelColor((b+6)%stripSize,0,0,127);
strip.setPixelColor(r,2,0,0);
strip.setPixelColor((r+stripSize-1)%stripSize,9,0,0);
strip.setPixelColor((r+stripSize-2)%stripSize,16,0,0);
strip.setPixelColor((r+stripSize-3)%stripSize,40,0,0);
strip.setPixelColor((r+stripSize-4)%stripSize,55,0,0);
strip.setPixelColor((r+stripSize-5)%stripSize,80,0,0);
strip.setPixelColor((r+stripSize-6)%stripSize,127,0,0);
strip.show();
delay(dly);
strip.setPixelColor(b,0);
strip.setPixelColor(r,0);
strip.show();
if (b++==stripSize) b=0;
if (r--==0) r=stripSize-1;
}
butPush = 1;
}