-
-
Save focalintent/064d517982656d68b326 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
#include<FastLED.h> | |
#define NUM_LEDS 178 | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
FastLED.addLeds<WS2811,7,GRB>(leds, NUM_LEDS); | |
// do the initial setup of leds | |
fill_solid(leds, NUM_LEDS, CRGB(32,0,32)); | |
} | |
void loop() { | |
// fade any currently high leds | |
for(int i = 0; i < NUM_LEDS; i++) { | |
if(leds[i].r > 32) { leds[i].r--; } | |
if(leds[i].b > 32) { leds[i].b--; } | |
} | |
// pick a random led and make it high | |
int nPicked = random16() % NUM_LEDS; | |
leds[nPicked] = CRGB(64,0,64); | |
// show the leds | |
FastLED.show(); | |
// delay for a little bit - this means it'll take roughly 1 second for leds to fade from (64,0,64) back to (32,0,32) | |
delay(30); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment