#include #define NUM_STRIPS 3 #define NUM_LEDS_PER_STRIP 24 #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS #define BRIGHTNESS 255 // 255 is full brightness, 128 is half #define MIN_BRIGHTNESS 8 // watch the power! #define MAX_BRIGHTNESS 255 // watch the power! CRGB leds[NUM_LEDS]; int db[] = {2,3,1,4,0,5,8,6,7, 13,14,12,15,11,16,10,17,9, 25,24,26,23,18,22,19,21,20}; void setup() { delay( 2000 ); // power-up safety delay //Set all lights to make sure all are working as expected // Assign pin 3, 5 and 6 as LED singal pin FastLED.addLeds(leds, 0, NUM_LEDS_PER_STRIP); FastLED.addLeds(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); FastLED.addLeds(leds, NUM_LEDS_PER_STRIP*2, NUM_LEDS_PER_STRIP); FastLED.setBrightness( BRIGHTNESS ); //set rainbow background fill_rainbow(leds, NUM_LEDS, 0, 9); FastLED.show(); delay(1000); } void loop() { //clear background fill_solid(leds, NUM_LEDS, CRGB::Black); for(int n = 0; n < NUM_LEDS; n++) { meteorRain(10, 32, true, 30, n); leds[db[n]] = CHSV(n*9,255,255); FastLED.show(); } } void meteorRain(byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay, int n) { //for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) { //change the above loop for reversed direction for(int i = NUM_LEDS+NUM_LEDS; i > n; i--) { // fade brightness LEDs one step // j=n fade less by each step; j=0 fade all in each step for(int j=n; j5) ) { fadeToBlack(j, meteorTrailDecay ); } } // draw meteor for(int j = 0; j < meteorSize; j++) { if( ( i-j =0) ) { leds[db[i-j]] = CHSV((i-j)*9,255,255); } } FastLED.show(); delay(SpeedDelay); } } void fadeToBlack(int ledNo, byte fadeValue) { leds[db[ledNo]].fadeToBlackBy( fadeValue ); }