-
-
Save marmilicious/33c1c1ab7b66535c8b9e662efae4a23f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean goForward = true; | |
void loop() { | |
static uint8_t hue = 0; | |
static uint8_t count = 0; | |
//if (goForward == true && count < NUM_LEDS) { | |
if (goForward == true) { | |
EVERY_N_MILLISECONDS(15){ | |
for(int i = 0; i < NUM_LEDS; i++) { | |
leds[i] = CHSV((hue++ + 20), 255, 255); | |
FastLED.show(); | |
fadeToBlackBy( leds, NUM_LEDS, 250); | |
} | |
count++; | |
} | |
if (count == NUM_LEDS) { goForward = false; } | |
} | |
if (goForward == false) { | |
// Now go in the other direction. | |
EVERY_N_MILLISECONDS(2){ | |
for(int i = (NUM_LEDS); i >= 0; i--) { | |
leds[i] = CHSV((hue++ + 20), 255, 255); | |
FastLED.show(); | |
fadeToBlackBy( leds, NUM_LEDS, 250); | |
} | |
count--; | |
if (count == 0) { goForward = true; } | |
} | |
} | |
}//end of main loop | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment