Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Arduino Meteor rain
Clear all

Arduino Meteor rain

2 Posts
2 Users
Active Member
Joined: 4 years ago
Posts: 4
Topic starter  

I would like to add meteor rain to start up sequence and have it run twice before continuing the rest of the program. Wound you have an example on what I need to do. Thanks.

Famed Member Admin
Joined: 10 years ago
Posts: 2554

Hi JerryC,

It depends a little on where you're copying the meteor rain effect from.
I have 2 projects that use it: the original LED Effects project, and the All-in-One LED Effects project.

Meteor rain in the original project (link) is probably the best one to use for your question.

When using the effects in that project, the you could call the meteor rain function twice and then call for another effect.

For example:

void loop() {
  // run meteor rain twice
  meteorRain(0xff,0xff,0xff,10, 64, true, 30);
  meteorRain(0xff,0xff,0xff,10, 64, true, 30);

  // run the rest of the program which can even be other effects if you'd like.

// effects

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) {
    // fade brightness all LEDs one step
    for(int j=0; j<NUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)>5) ) {
        fadeToBlack(j, meteorTrailDecay );        
    // draw meteor
    for(int j = 0; j < meteorSize; j++) {
      if( ( i-j <NUM_LEDS) && (i-j>=0) ) {
        setPixel(i-j, red, green, blue);

void fadeToBlack(int ledNo, byte fadeValue) {
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor & 0x00ff0000UL) >> 16;
    g = (oldColor & 0x0000ff00UL) >> 8;
    b = (oldColor & 0x000000ffUL);

    r=(r<=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g<=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b<=10)? 0 : (int) b-(b*fadeValue/256);
    strip.setPixelColor(ledNo, r,g,b);
   // FastLED
   leds[ledNo].fadeToBlackBy( fadeValue );


Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).