Skip to content

Instantly share code, notes, and snippets.

@shmick
Forked from hsiboy/stripedTwinkle.ino
Created November 21, 2016 05:58
Show Gist options
  • Save shmick/64019c0c7af7105369af65277c694966 to your computer and use it in GitHub Desktop.
Save shmick/64019c0c7af7105369af65277c694966 to your computer and use it in GitHub Desktop.
fastled - striped twinkle
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