-
-
Save shmick/64019c0c7af7105369af65277c694966 to your computer and use it in GitHub Desktop.
fastled - striped twinkle
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
void stripedTwinkle(){ | |
int twinkle = 0; | |
int flash = 15; // twinkle flash time | |
int lag = 50; // time between twinkles | |
for (i = 0; i <LED_NUM i++) | |
{ | |
if (i % 2 == 0) | |
{ | |
leds[twinkle] = CRGB::Red; | |
}else{ | |
leds[twinkle] = CRGB::Green; | |
} | |
FastLED.show(); | |
} | |
// add twinkles | |
for (int i=0; i <= 150; i++){ | |
twinkle = random(NUM_LEDS); | |
leds[twinkle] = CRGB::White; | |
FastLED.show(); | |
FastLED.delay(flash); | |
if (twinkle % 2 == 0) | |
{ | |
//RESTORE PIXEL | |
leds[twinkle] = CRGB::Red; | |
FastLED.show(); | |
}else{ | |
leds[twinkle] = CRGB::Green; | |
FastLED.show(); | |
} | |
delay(lag); | |
} // end for loop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment