<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Problem with reverse meteor rain - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 09 Jun 2026 02:20:13 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Problem with reverse meteor rain</title>
                        <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-4707</link>
                        <pubDate>Fri, 17 Feb 2023 02:50:19 +0000</pubDate>
                        <description><![CDATA[BiiiG THX for the &quot;reverse&quot;-Solution!!!]]></description>
                        <content:encoded><![CDATA[<p>BiiiG THX for the "reverse"-Solution!!!</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Anonymous</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-4707</guid>
                    </item>
				                    <item>
                        <title>RE: Problem with reverse meteor rain</title>
                        <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3611</link>
                        <pubDate>Tue, 15 Jun 2021 11:39:52 +0000</pubDate>
                        <description><![CDATA[Awesome - good to hear that worked!  😁  👍]]></description>
                        <content:encoded><![CDATA[<p>Awesome - good to hear that worked!  😁  👍 </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3611</guid>
                    </item>
				                    <item>
                        <title>RE: Problem with reverse meteor rain</title>
                        <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3610</link>
                        <pubDate>Mon, 14 Jun 2021 21:52:47 +0000</pubDate>
                        <description><![CDATA[Posted by: @hans 
I&#039;ve added you video here for future reference, I hope that&#039;s OK. (as a new user you cannot yet upload video&#039;s - apologies for the inconvenience)

First off, in the orig...]]></description>
                        <content:encoded><![CDATA[<blockquote data-userid="1" data-postid="3607" data-mention="hans">
<div class="wpforo-post-quote-author"><strong> Posted by: @hans </strong></div>
<p>I've added you video here for future reference, I hope that's OK. (as a new user you cannot yet upload video's - apologies for the inconvenience)</p>
210
<p>First off, in the original code I count to NUM_LEDS+NUM_LEDS intentionally so it exceeds the length of the LED strip and all LEDs can fade.<br />(the 3rd line, the for-loop, in the effect code)</p>
<p>Now ... working in reverse would cause some extra issues to look at (like negative led numbers).<br />So I'd probably keep the original code the same, and add functions that handle the setPixel (setReversePixel) and fadeToBlack (reverseFadeToBlack) in reverse. <br />Something like this (untested - I hope I didn't make any typos):</p>
<pre contenteditable="false">void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
 
  for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {
     
    // fade brightness all LEDs one step
    for(int j=0; j&lt;NUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)&gt;5) ) {
        reverseFadeToBlack(j, meteorTrailDecay );        
      }
    }
   
    // draw meteor
    for(int j = 0; j &lt; meteorSize; j++) {
      if( ( i-j &lt;NUM_LEDS) &amp;&amp; (i-j&gt;=0) ) {
        setReversePixel(i-j, red, green, blue);
      }
    }
   
    showStrip();
    delay(SpeedDelay);
  }
}

void setReversePixel(int Pixel, byte red, byte green, byte blue) {
  int reversePixel = NUM_LEDS-Pixel;
  
  if( (reversePixel&gt;=0) &amp;&amp; (reversePixel&lt;NUM_LEDS) ) {
    setPixel(reversePixel, red, green, blue); 
  }
}

void reverseFadeToBlack(int ledNo, byte fadeValue) {
  int reversePixel = NUM_LEDS-ledNo;
  
  if( (reversePixel&gt;=0) &amp;&amp; (reversePixel&lt;NUM_LEDS) ) {
    fadeToBlack(reversePixel, fadeValue); 
  }
}

void fadeToBlack(int ledNo, byte fadeValue) {
 #ifdef ADAFRUIT_NEOPIXEL_H
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
   
    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor &amp; 0x00ff0000UL) &gt;&gt; 16;
    g = (oldColor &amp; 0x0000ff00UL) &gt;&gt; 8;
    b = (oldColor &amp; 0x000000ffUL);

    r=(r&lt;=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g&lt;=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b&lt;=10)? 0 : (int) b-(b*fadeValue/256);
   
    strip.setPixelColor(ledNo, r,g,b);
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds.fadeToBlackBy( fadeValue );
 #endif  
}</pre>
</blockquote>
<p>it worked flawslessly!</p>
<p> </p>
<p>Thank you very much for the fast response!</p>
<p> </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Anonymous</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3610</guid>
                    </item>
				                    <item>
                        <title>RE: Problem with reverse meteor rain</title>
                        <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3607</link>
                        <pubDate>Sun, 13 Jun 2021 11:02:51 +0000</pubDate>
                        <description><![CDATA[I&#039;ve added you video here for future reference, I hope that&#039;s OK. (as a new user you cannot yet upload video&#039;s - apologies for the inconvenience)

First off, in the original code I count t...]]></description>
                        <content:encoded><![CDATA[<p>I've added you video here for future reference, I hope that's OK. (as a new user you cannot yet upload video's - apologies for the inconvenience)</p>
210
<p>First off, in the original code I count to NUM_LEDS+NUM_LEDS intentionally so it exceeds the length of the LED strip and all LEDs can fade.<br />(the 3rd line, the for-loop, in the effect code)</p>
<p>Now ... working in reverse would cause some extra issues to look at (like negative led numbers).<br />So I'd probably keep the original code the same, and add functions that handle the setPixel (setReversePixel) and fadeToBlack (reverseFadeToBlack) in reverse. <br />Something like this (untested - I hope I didn't make any typos):</p>
<pre contenteditable="false">void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
 
  for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {
     
    // fade brightness all LEDs one step
    for(int j=0; j&lt;NUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)&gt;5) ) {
        reverseFadeToBlack(j, meteorTrailDecay );        
      }
    }
   
    // draw meteor
    for(int j = 0; j &lt; meteorSize; j++) {
      if( ( i-j &lt;NUM_LEDS) &amp;&amp; (i-j&gt;=0) ) {
        setReversePixel(i-j, red, green, blue);
      }
    }
   
    showStrip();
    delay(SpeedDelay);
  }
}

void setReversePixel(int Pixel, byte red, byte green, byte blue) {
  int reversePixel = NUM_LEDS-Pixel;
  
  if( (reversePixel&gt;=0) &amp;&amp; (reversePixel&lt;NUM_LEDS) ) {
    setPixel(reversePixel, red, green, blue); 
  }
}

void reverseFadeToBlack(int ledNo, byte fadeValue) {
  int reversePixel = NUM_LEDS-ledNo;
  
  if( (reversePixel&gt;=0) &amp;&amp; (reversePixel&lt;NUM_LEDS) ) {
    fadeToBlack(reversePixel, fadeValue); 
  }
}

void fadeToBlack(int ledNo, byte fadeValue) {
 #ifdef ADAFRUIT_NEOPIXEL_H
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
   
    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor &amp; 0x00ff0000UL) &gt;&gt; 16;
    g = (oldColor &amp; 0x0000ff00UL) &gt;&gt; 8;
    b = (oldColor &amp; 0x000000ffUL);

    r=(r&lt;=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g&lt;=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b&lt;=10)? 0 : (int) b-(b*fadeValue/256);
   
    strip.setPixelColor(ledNo, r,g,b);
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds.fadeToBlackBy( fadeValue );
 #endif  
}</pre>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3607</guid>
                    </item>
				                    <item>
                        <title>Problem with reverse meteor rain</title>
                        <link>https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3603</link>
                        <pubDate>Sat, 12 Jun 2021 13:08:15 +0000</pubDate>
                        <description><![CDATA[Good day for everyone! i try to do a reverse meteor rain effect in arduino, based on some codes that are on the page, it runs well but at the end the meteor doesnt fade to black, ill share t...]]></description>
                        <content:encoded><![CDATA[<p>Good day for everyone! i try to do a reverse meteor rain effect in arduino, based on some codes that are on the page, it runs well but at the end the meteor doesnt fade to black, ill share the code and a video</p>
<p>Thanks for stoping by!</p>
<p><a title="https://odysee.com/@Gutss:6/video:3" href="https://odysee.com/@Gutss:6/video:3" target="true">https://odysee.com/@Gutss:6/video:3</a></p>
<pre contenteditable="false">void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
 
  for(int i = NUM_LEDS-1; i&gt;=meteorSize; i--) {
   
   
    // fade brightness all LEDs one step
    for(int j=0; j&lt;NUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)&gt;5) ) {
        fadeToBlack(j, meteorTrailDecay );        
      }
    }
   
    // draw meteor
    for(int j = 0; j &lt; meteorSize; j++) {
      if( i-j&gt;0 ) {
        setPixel(i-j, red, green, blue);
      }
    }
   
    showStrip();
    delay(SpeedDelay);
  }
}

void fadeToBlack(int ledNo, byte fadeValue) {
 #ifdef ADAFRUIT_NEOPIXEL_H
    // NeoPixel
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
   
    oldColor = strip.getPixelColor(ledNo);
    r = (oldColor &amp; 0x00ff0000UL) &gt;&gt; 16;
    g = (oldColor &amp; 0x0000ff00UL) &gt;&gt; 8;
    b = (oldColor &amp; 0x000000ffUL);

    r=(r&lt;=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g&lt;=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b&lt;=10)? 0 : (int) b-(b*fadeValue/256);
   
    strip.setPixelColor(ledNo, r,g,b);
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds.fadeToBlackBy( fadeValue );
 #endif  
}
void colorWipe(byte red, byte green, byte blue, int SpeedDelay) {
  for(int i = NUM_LEDS+NUM_LEDS; i &gt; 0; i--) {
      setPixel(i, red, green, blue);
      showStrip();
      delay(SpeedDelay);
  }
}</pre>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Anonymous</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/problem-with-reverse-meteor-rain/#post-3603</guid>
                    </item>
							        </channel>
        </rss>
		