Skip to content

Commit

Permalink
Added theaterChase and theaterChaseRainbow
Browse files Browse the repository at this point in the history
Added two new effect functions. theaterChase does a
theater-marquee-style chase, and theaterChaserainbow combines the
theaterChase with the rainbow effect
  • Loading branch information
driverblock committed Dec 27, 2013
1 parent 99876f5 commit 8a14896
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions examples/strandtest/strandtest.pde → examples/strandtest/strandtest.ino
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,23 @@ void loop() {
colorChase(strip.Color( 0, 0, 127), 50); // Blue
colorChase(strip.Color(127, 0, 127), 50); // Violet

// Send a theater pixel chase in...
theaterChase(strip.Color(127, 127, 127), 50); // White
theaterChase(strip.Color(127, 0, 0), 50); // Red
theaterChase(strip.Color(127, 127, 0), 50); // Yellow
theaterChase(strip.Color( 0, 127, 0), 50); // Green
theaterChase(strip.Color( 0, 127, 127), 50); // Cyan
theaterChase(strip.Color( 0, 0, 127), 50); // Blue
theaterChase(strip.Color(127, 0, 127), 50); // Violet

// Fill the entire strip with...
colorWipe(strip.Color(127, 0, 0), 50); // Red
colorWipe(strip.Color( 0, 127, 0), 50); // Green
colorWipe(strip.Color( 0, 0, 127), 50); // Blue

rainbow(10);
rainbowCycle(0); // make it go through the cycle fairly fast
theaterChaseRainbow(50);
}

void rainbow(uint8_t wait) {
Expand Down Expand Up @@ -113,6 +123,41 @@ void colorChase(uint32_t c, uint8_t wait) {
strip.show(); // Refresh to turn off last pixel
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();

delay(wait);

for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
for (int j=0; j < 384; j++) { // cycle all 384 colors in the wheel
for (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, Wheel( (i+j) % 384)); //turn every third pixel on
}
strip.show();

delay(wait);

for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}
/* Helper functions */

//Input a value 0 to 384 to get a color value.
Expand Down

0 comments on commit 8a14896

Please sign in to comment.