Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Created January 9, 2015 09:52
Show Gist options
  • Save hsiboy/b9d9ea65e04dd2e6f618 to your computer and use it in GitHub Desktop.
Save hsiboy/b9d9ea65e04dd2e6f618 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