Compiles, not tested.
#include "FastLED.h"
#define NUM_STRIPS 12
#define NUM_LEDS_PER_STRIP 37
const uint8_t pinStrip1 = 1;
const uint8_t pinStrip2 = 2;
const uint8_t pinStrip3 = 3;
const uint8_t pinStrip4 = 4;
const uint8_t pinStrip5 = 5;
const uint8_t pinStrip6 = 6;
const uint8_t pinStrip7 = 7;
const uint8_t pinStrip8 = 8;
const uint8_t pinStrip9 = 9;
const uint8_t pinStrip10 = 10;
const uint8_t pinStrip11 = 11;
const uint8_t pinStrip12 = 12;
CRGB grLeds[NUM_STRIPS][NUM_LEDS_PER_STRIP];
void setup()
{
//delay(5500); //?
FastLED.addLeds<WS2811, pinStrip1, GRB>(grLeds[0], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip2, GRB>(grLeds[1], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip3, GRB>(grLeds[2], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip4, GRB>(grLeds[3], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip5, GRB>(grLeds[4], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip6, GRB>(grLeds[5], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip7, GRB>(grLeds[6], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip8, GRB>(grLeds[7], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip9, GRB>(grLeds[8], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip10, GRB>(grLeds[9], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip11, GRB>(grLeds[10], NUM_LEDS_PER_STRIP);
FastLED.addLeds<WS2811, pinStrip12, GRB>(grLeds[11], NUM_LEDS_PER_STRIP);
}//setup
void loop()
{
meteorRain( CRGB(0x00,0x00,0x00), CRGB(0xff,0xff,0xff), 10, 64, true, 30 );
}//loop
//
void meteorRain( CRGB ColorBackground, CRGB ColorMeteor, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay )
{
// set background color
for( uint8_t i=0; i<NUM_STRIPS; i++ )
fill_solid( grLeds[i], NUM_LEDS_PER_STRIP, ColorBackground );
for(uint8_t i=0; i<NUM_LEDS_PER_STRIP*2; i++ )
{
for( uint8_t strip=0; strip<NUM_STRIPS; strip++ )
{
// fade color to background color for all LEDs
for(uint8_t led=0; led<NUM_LEDS_PER_STRIP; led++ )
{
if( (!meteorRandomDecay) || (random(10) > 5) )
{
grLeds[strip][led] = fadeTowardColor( grLeds[strip][led], ColorBackground, meteorTrailDecay );
}//if
}//for
// draw meteor
for( uint8_t j=0; j<meteorSize; j++ )
{
if( ( (i-j) < NUM_LEDS_PER_STRIP) && ((i-j) >= 0) )
{
grLeds[strip][i-j] = ColorMeteor;
}//if
}//for
}//for
FastLED.show();
delay( SpeedDelay );
}//for
}//meteorRain
CRGB fadeTowardColor( CRGB &cur, const CRGB &target, uint8_t amount )
{
nblendU8TowardU8( cur.red, target.red, amount);
nblendU8TowardU8( cur.green, target.green, amount);
nblendU8TowardU8( cur.blue, target.blue, amount);
return cur;
}//fadeTowardColor
void nblendU8TowardU8( uint8_t &cur, const uint8_t target, uint8_t amount )
{
if( cur == target)
return;
if( cur < target )
{
uint8_t delta = target - cur;
delta = scale8_video( delta, amount);
cur += delta;
}//if
else
{
uint8_t delta = cur - target;
delta = scale8_video( delta, amount);
cur -= delta;
}//else
}//nblendU8TowardU8