Skip to content

Instantly share code, notes, and snippets.

@kbostick88
Created November 7, 2018 01:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbostick88/d365cafd3d3f8b1cecc3a3baf3d4a3e6 to your computer and use it in GitHub Desktop.
Save kbostick88/d365cafd3d3f8b1cecc3a3baf3d4a3e6 to your computer and use it in GitHub Desktop.
if (setEffect == "Red Green White Loop") {
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CRGB(255, 0, 0);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(40);
}
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CRGB(0, 255, 0);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(40);
}
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CRGB(255, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(40);
}
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CRGB(0, 255, 0);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(40);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment