<?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>
									Simple Sketch Request - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 09 Jun 2026 02:46:32 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1535</link>
                        <pubDate>Tue, 19 Feb 2019 04:23:31 +0000</pubDate>
                        <description><![CDATA[Cool to see that you&#039;ve gotten a little further and I&#039;m sorry that I do not have the ability to test (at the moment).It shouldn&#039;t be impossible to make this loop though.One note; in your cod...]]></description>
                        <content:encoded><![CDATA[<p>Cool to see that you've gotten a little further and I'm sorry that I do not have the ability to test (at the moment).<br>It shouldn't be impossible to make this loop though.</p><p>One note; in your code check out these lines:</p><pre>i++;<br>if(i&gt;=NUM_LEDS+NUM_LEDS) { i=0; }</pre><p>In your case it will keep resetting the for-loop and make it keep going and going and going ...</p><p>Under ideal circumstances we'd want the leds to be addressed even when beyond number of LEDs.<br>What I mean with that; if we have 10 leds, and the counter (i) is goes to the 11th led, then that 11th led should become the first led.</p><pre>void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {&nbsp;&nbsp;<br>&nbsp; int i=0;<br>&nbsp; setAll(0,0,0);<br>&nbsp;&nbsp;<br>&nbsp; for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // fade brightness all LEDs one step<br>&nbsp; &nbsp; for(int j=0; j &lt; NUM_LEDS; j++) {<br>&nbsp; &nbsp; &nbsp; if( (!meteorRandomDecay) || (random(10)&gt;5) ) {  fadeToBlack(j, meteorTrailDecay); }<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // draw meteor<br>&nbsp; &nbsp; for(int j=0; j &lt; meteorSize; j++) {<br>&nbsp; &nbsp; &nbsp; if( ( i-j &lt; NUM_LEDS) &amp;&amp; (i-j &gt;= 0) )&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { setPixel(i-j, red, green, blue); }&nbsp;<br>&nbsp; &nbsp; &nbsp; else // try removing this: if (i&lt;j)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { setPixel(NUM_LEDS-j, red, green, blue); } // added this so it does "negative" LED positions as well<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; &nbsp; i++;<br>&nbsp; &nbsp; if(i&gt;=NUM_LEDS+NUM_LEDS) { i=0; }<br>&nbsp; }<br>}</pre><p>In the "draw meteor" section, you may want to toy with that loop.</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/simple-sketch-request-2/#post-1535</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1534</link>
                        <pubDate>Mon, 18 Feb 2019 20:05:59 +0000</pubDate>
                        <description><![CDATA[Did a bit of playing. Removed the while statement and removed the //was, so now it&#039;s just for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {
The code is as follows:
void meteorRain(byte red, by...]]></description>
                        <content:encoded><![CDATA[Did a bit of playing. Removed the while statement and removed the //was, so now it's just for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {
The code is as follows:
<pre>void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  int i=0;
  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) ) {  fadeToBlack(j, meteorTrailDecay); }
    }
    
    // draw meteor
    for(int j=0; j &lt; meteorSize; j++) {
      if( ( i-j &lt; NUM_LEDS) &amp;&amp; (i-j &gt;= 0) ) 
          { setPixel(i-j, red, green, blue); } 
      else if (i&lt;j)
          { setPixel(NUM_LEDS-j, red, green, blue); } // added this so it does "negative" LED positions as well
    }
   
    showStrip();
    delay(SpeedDelay);

    i++;
    if(i&gt;=NUM_LEDS+NUM_LEDS) { i=0; }
  }
}
</pre><div>This also works, thought it isn't a complete loop. The effect also seems to run significantly faster than when the while statement was still there, don't know if that's worth anything.</div><div>Also a correction to my previous post, it's the first picture with the strip, not the second.</div>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>bbitz01</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1534</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1533</link>
                        <pubDate>Mon, 18 Feb 2019 20:00:41 +0000</pubDate>
                        <description><![CDATA[hans,Yes, it is a computer case - the LED strip goes in a ring around the edge (that&#039;s why I want the effect to be a full circle instead of cutting off at the end of the strip). You can&#039;t se...]]></description>
                        <content:encoded><![CDATA[<p>hans,</p><p>Yes, it is a computer case - the LED strip goes in a ring around the edge (that's why I want the effect to be a full circle instead of cutting off at the end of the strip). You can't see the strip in the first picture, but you can in the second.</p><p>Anyways, the code you posted this time did work - the effect the same as the code from the original post, I'm assuming this is what you were going for just to make sure everything works properly.&nbsp;<img width="32" height="32" class="t4a_smiley" alt="" src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_smile.png" /> </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>bbitz01</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1533</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1517</link>
                        <pubDate>Tue, 12 Feb 2019 04:51:04 +0000</pubDate>
                        <description><![CDATA[p.s. you can also post an image or small video a an attachment ...&nbsp; For video I recommend pulling it through HandBrake to get a more efficient file size.]]></description>
                        <content:encoded><![CDATA[<p>p.s. you can also post an image or small video a an attachment ...&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_smile.png" class="t4a_smiley" alt="" width="32" height="32"> </p><p>For video I recommend pulling it through HandBrake to get a more efficient file size.</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/simple-sketch-request-2/#post-1517</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1516</link>
                        <pubDate>Tue, 12 Feb 2019 04:50:09 +0000</pubDate>
                        <description><![CDATA[Hi bbitz01,the link of the picture didn&#039;t work, and when I changed &quot;http&quot; to &quot;https&quot; I got a picture of PC case ... ?Anyhoo ... we must be overlooking something simple, although I&#039;m surprise...]]></description>
                        <content:encoded><![CDATA[<p>Hi bbitz01,</p><p>the link of the picture didn't work, and when I changed "http" to "https" I got a picture of PC case ... ?</p><p>Anyhoo ... we must be overlooking something simple, although I'm surprised that FastLED isn't working for you. Maybe the knock off Nano is to blame, but I kinda doubt that.<br>I still do not have my hardware available to test, so let's see what could be wrong with the code. I have moved around code a little to make it more readable for myself ...</p><p>This is what should work, or at least should show "something" ....</p><pre>void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {&nbsp;&nbsp;<br>  int i=0;
&nbsp; setAll(0,0,0);<br>&nbsp;&nbsp;
  while(true) { // was: for(int i = 0; i &lt; NUM_LEDS+NUM_LEDS; i++) {<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // fade brightness all LEDs one step<br>&nbsp; &nbsp; for(int j=0; j &lt; NUM_LEDS; j++) {<br>&nbsp; &nbsp; &nbsp; if( (!meteorRandomDecay) || (random(10)&gt;5) ) {  fadeToBlack(j, meteorTrailDecay);&nbsp;}<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // draw meteor<br>&nbsp; &nbsp; for(int j=0; j &lt; meteorSize; j++) {<br>&nbsp; &nbsp; &nbsp; if( ( i-j &lt; NUM_LEDS) &amp;&amp; (i-j &gt;= 0) ) 
          { setPixel(i-j, red, green, blue); }&nbsp;
      else if (i&lt;j)
          { setPixel(NUM_LEDS-j, red, green, blue); } // added this so it does "negative" LED positions as well<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);

    i++;
    if(i&gt;=NUM_LEDS+NUM_LEDS) { i=0; }<br>&nbsp; }<br>}</pre><p>I'm not sure what I'm overlooking if this one doesn't work - then again, it's early in the morning here and I may need some more coffee&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_grin.png" class="t4a_smiley" alt="" width="32" height="32"></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/simple-sketch-request-2/#post-1516</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1515</link>
                        <pubDate>Sun, 10 Feb 2019 20:45:46 +0000</pubDate>
                        <description><![CDATA[hans,
I&#039;m having the same issue as last time. Using this code (with the part you wrote):
#include &lt;Adafruit_NeoPixel.h&gt;
#define PIN 3
#define NUM_LEDS 81
// Parameter 1 = number of pix...]]></description>
                        <content:encoded><![CDATA[hans,
I'm having the same issue as last time. Using this code (with the part you wrote):
<pre>#include &lt;Adafruit_NeoPixel.h&gt;
#define PIN 3
#define NUM_LEDS 81
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  meteorRain(0xff,0xff,0xff,10, 64, true, 30);
}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
  int i = 0;
  
  while(true){
    
    // 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 &lt;NUM_LEDS) &amp;&amp; (i-j&gt;=0) ) {
        setPixel(i-j, red, green, blue);
      } 
    }
   
    showStrip();
    delay(SpeedDelay);
    i++;
    if(i=NUM_LEDS+NUM_LEDS-1) { i=0; }
  }
}


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 showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds.r = red;
   leds.g = green;
   leds.b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i &lt; NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}
</pre>I get this:
http://s61.photobucket.com/user/bbitz01/media/IMG-2406_zpsfa0jhuez.jpg.html?sort=3&amp;o=0
That one light stays just like that and does not fade, flash, change color, move, or anything else.
The strip does work just fine with other effects. With very similar code, using the default meteor rain effect from the post mentioned earlier:
<pre>#include &lt;Adafruit_NeoPixel.h&gt;
#define PIN 3
#define NUM_LEDS 81
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  meteorRain(0xff,0xff,0xff,10, 64, true, 30);
}

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) ) {
        fadeToBlack(j, meteorTrailDecay );        
      }
    }
    
    // draw meteor
    for(int j = 0; j &lt; meteorSize; j++) {
      if( ( i-j &lt;NUM_LEDS) &amp;&amp; (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 showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds.r = red;
   leds.g = green;
   leds.b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i &lt; NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}
</pre>I get this (the effect is moving around, it's just a still picture):
http://s61.photobucket.com/user/bbitz01/media/IMG-2405_zpsiybakvkg.jpg.html?sort=3&amp;o=1
Perhaps I'm doing something wrong on my end? Additionally, for some reason I've never been able to get FastLED to work, don't know why.&nbsp;<img width="32" height="32" class="t4a_smiley" alt="" src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_thinking.png" />&nbsp;
Thanks.]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>bbitz01</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1515</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1512</link>
                        <pubDate>Sun, 10 Feb 2019 10:34:40 +0000</pubDate>
                        <description><![CDATA[Haha, I had forgotten about it as well ... sorry!&nbsp; First of all; I&#039;d recommend using FastLED instead of NeoPixel.As for the code (still not able to test this myself), I think I may have...]]></description>
                        <content:encoded><![CDATA[<p>Haha, I had forgotten about it as well ... sorry!&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_laughing.png" class="t4a_smiley" alt="" width="32" height="32"> </p><p>First of all; I'd recommend using FastLED instead of NeoPixel.<br>As for the code (still not able to test this myself), I think I may have found a boo-boo ... (3rd line from the bottom, added a "-1");</p><pre>void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {&nbsp;&nbsp;<br>&nbsp; setAll(0,0,0);<br>&nbsp; int i = 0;<br>&nbsp;&nbsp;<br>&nbsp; while(true){<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // fade brightness all LEDs one step<br>&nbsp; &nbsp; for(int j=0; j&lt;NUM_LEDS; j++) {<br>&nbsp; &nbsp; &nbsp; if( (!meteorRandomDecay) || (random(10)&gt;5) ) {<br>&nbsp; &nbsp; &nbsp; &nbsp; fadeToBlack(j, meteorTrailDecay );&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // draw meteor<br>&nbsp; &nbsp; for(int j = 0; j &lt; meteorSize; j++) {<br>&nbsp; &nbsp; &nbsp; if( ( i-j &lt;NUM_LEDS) &amp;&amp; (i-j&gt;=0) ) {<br>&nbsp; &nbsp; &nbsp; &nbsp; setPixel(i-j, red, green, blue);<br>&nbsp; &nbsp; &nbsp; }&nbsp;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; &nbsp; i++;<br>&nbsp; &nbsp; if(i=NUM_LEDS+NUM_LEDS-1) { i=0; }<br>&nbsp; }<br>}</pre><p>But even with that, I would have expected to see at least something happen. Does the strip work properly with other effects?</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/simple-sketch-request-2/#post-1512</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1510</link>
                        <pubDate>Sat, 09 Feb 2019 15:48:56 +0000</pubDate>
                        <description><![CDATA[hans,Any luck with the sketch? I haven&#039;t messed with my Arduino in a while, kind of forgot about it if I&#039;m honest.&nbsp;&nbsp;Hope you enjoyed your holidays.]]></description>
                        <content:encoded><![CDATA[<p>hans,</p><p>Any luck with the sketch? I haven't messed with my Arduino in a while, kind of forgot about it if I'm honest.&nbsp;<img width="32" height="32" class="t4a_smiley" alt="" src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_laughing.png" />&nbsp;</p><p>Hope you enjoyed your holidays.</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>bbitz01</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1510</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1466</link>
                        <pubDate>Mon, 31 Dec 2018 09:02:20 +0000</pubDate>
                        <description><![CDATA[I&#039;ll have to wait until I get home (on a holiday trip right now) to do some testing.I may have overlooked something. Unfortunately, I do not have my Arduino with me to do testing&nbsp;&nbsp;...]]></description>
                        <content:encoded><![CDATA[<p>I'll have to wait until I get home (on a holiday trip right now) to do some testing.<br>I may have overlooked something. Unfortunately, I do not have my Arduino with me to do testing&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_crying.png" class="t4a_smiley" alt="" width="32" height="32">&nbsp;...</p><p>Happy New Year!</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/simple-sketch-request-2/#post-1466</guid>
                    </item>
				                    <item>
                        <title>RE: Simple Sketch Request</title>
                        <link>https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1464</link>
                        <pubDate>Fri, 28 Dec 2018 12:57:14 +0000</pubDate>
                        <description><![CDATA[hans,If I put in your code correctly (which I&#039;m not sure I did), I have this:#include &lt;Adafruit_NeoPixel.h&gt;
#define PIN 3
#define NUM_LEDS 81

Adafruit_NeoPixel strip = Adafruit_NeoPix...]]></description>
                        <content:encoded><![CDATA[<p>hans,</p><p>If I put in your code correctly (which I'm not sure I did), I have this:</p><pre>#include &lt;Adafruit_NeoPixel.h&gt;
#define PIN 3
#define NUM_LEDS 81

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  meteorRain(0xff,0xff,0xff,10, 64, true, 30);
}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
  int i = 0;
  
  while(true){
    
    // 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 &lt;NUM_LEDS) &amp;&amp; (i-j&gt;=0) ) {
        setPixel(i-j, red, green, blue);
      } 
    }
   
    showStrip();
    delay(SpeedDelay);

    i++;
    if(i=NUM_LEDS+NUM_LEDS) { i=0; }
  }
}

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 showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds.r = red;
   leds.g = green;
   leds.b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i &lt; NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}
</pre><p>Unfortunately this just lights up the first LED on my strip white. It doesn't move, fade, etc. Perhaps I've put in the code wrong?</p><p>And no need to worry about a late reply, we've all got things to do. <img width="32" height="32" class="t4a_smiley" alt="" src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_cool.png" /> </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>bbitz01</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/simple-sketch-request-2/#post-1464</guid>
                    </item>
							        </channel>
        </rss>
		