<?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>
									Troy&#039;s project - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/troys-project/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Sun, 09 Aug 2026 10:58:50 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1582</link>
                        <pubDate>Fri, 17 May 2019 06:11:40 +0000</pubDate>
                        <description><![CDATA[Thanks Troy - it&#039;s always good to hear that, and definitely motivates me to keep doing what I&#039;m doing&nbsp; It reminds me a little bit about my University days. I wrote my thesis so normal f...]]></description>
                        <content:encoded><![CDATA[<p>Thanks Troy - it's always good to hear that, and definitely motivates me to keep doing what I'm doing&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>It reminds me a little bit about my University days. I wrote my thesis so normal folk would understand it as well (with my thesis presentation I had your peers sitting in, but the majority is family and friends). I really think information like that should be accessible by all people. And we should not "shield" our knowledge by keeping others out, either by poor attitude or by intentionally using language only a few really are familiar with. (I can keep ranting about that for another few hours hahah)</p><p>I do like what you're building - very cool! And yes I can see switches like that not being practical in that case.<br>Looking forward to seeing your end-product! And if something comes to mind I'll post it here right away.</p><p>Oh and of course; if you have question; you know where to find me.<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_cool.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/troys-project/paged/2/#post-1582</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1581</link>
                        <pubDate>Fri, 17 May 2019 06:03:44 +0000</pubDate>
                        <description><![CDATA[Well I for one am extremely grateful that you&#039;re willing to keep your code open and share it with the rest of us. I wouldn&#039;t have been able to finish this project without your help. Come to ...]]></description>
                        <content:encoded><![CDATA[Well I for one am extremely grateful that you're willing to keep your code open and share it with the rest of us. I wouldn't have been able to finish this project without your help. Come to think of it, I don't think I ever got a single question answered on the arduino forum. Just general statements that were of no help. Anyway, please keep on keeping on, this site is awesome!&nbsp;

I'm not sure that a switch like that would work considering how many effects/colors there are. Although its a solid idea but not right for my particular project. The end result is going to be a small circuit board holding the pro trinket, and power boast board with the buttons and on/off switch. That will all be attached to the lipo as one unit and attached to the side of the goggle strap. These goggles are going to be for raves/festivals so I wanted to have a simple three button set up so that someone could easily switch between the sittings without too much hassle. I'm sure they'll be a huge hit in the music scene! Youtube is a great idea actually, i'll be sure to make a video and put in a plug for this site!&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_wink.png" class="t4a_smiley" alt="" width="32" height="32" />]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1581</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1580</link>
                        <pubDate>Fri, 17 May 2019 05:30:11 +0000</pubDate>
                        <description><![CDATA[Thanks Troy!&nbsp; Yeah, I&#039;m aware of those kind of people. It&#039;s a reason why I&#039;m always wondering if I should or should not make code open source.It&#039;s weird how some people read the questio...]]></description>
                        <content:encoded><![CDATA[<p>Thanks Troy!&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>Yeah, I'm aware of those kind of people. It's a reason why I'm always wondering if I should or should not make code open source.<br>It's weird how some people read the question, complain and come with an answer nobody asked for.<br>I'm trying to keep my website clean of those kind of comments. I suppose it's easier to complain than to actually help or publish something people enjoy.<br>Oh well ... I know my code isn't perfect ... let them show something better ...&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><p>I'm still confused why the 2nd interrupt cause this much problems.<br>Maybe another alternative would be something like a <br>- multiposition switch to select an effect,<br>- potentiometer or another multiposition switch for color,<br>- a potentiometer for brightness,<br>- and "Apply" button that triggers the interrupt and reads the values of effect, color and brightness.</p><p>Anyhoo - sorry I couldn't be more helpful.<br>I'm curious what your project will look like in the end.<br>If you make a video of it (on YouTube for example), then please feel free to post the link here.&nbsp;&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_cool.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/troys-project/paged/2/#post-1580</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1579</link>
                        <pubDate>Fri, 17 May 2019 04:55:29 +0000</pubDate>
                        <description><![CDATA[Actually that&#039;s what I did when I first started debugging these issues. The issues with the functions started as soon as I enabled a second interrupt button, and it didn&#039;t matter whether the...]]></description>
                        <content:encoded><![CDATA[<p>Actually that's what I did when I first started debugging these issues. The issues with the functions started as soon as I enabled a second interrupt button, and it didn't matter whether they were both external interrupts or pin change interrupts. I tried posting about this on the arduino forum as well but the people there aren't nearly as helpful as you are. Someone even asked if this code was joke code and that it was badly designed because I had interrupt buttons....all they seemed to do is reference 'blink without delay' or nitpick at the code design rather than actually answer any of my questions.&nbsp;</p><p><br></p><p>At this point I'm resigned to the fact that whatever is causing these issues is something that is above me. I'll keep attempting to debug but now I'm working on the physical aspect of this project which is PCB prototyping and circuit board design. I'm going to attempt to add some additional functions at a later date but for now this is the final version. I don't know if I ever mentioned but this code is for an 'infinity goggle' project that I think you'll find very cool/interesting. Once I get my prototype complete I'll be sure to share the finished result!</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/paged/2/#post-1579</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1578</link>
                        <pubDate>Fri, 17 May 2019 04:41:25 +0000</pubDate>
                        <description><![CDATA[The “CRGB row1; // array used by colorWheel function” is used in the following code&nbsp;void setColorWheelColors(byte gRed, byte gGreen, byte gBlue) {&nbsp; row1 = CRGB(gRed, g...]]></description>
                        <content:encoded><![CDATA[<p>The “CRGB row1; // array used by colorWheel function” is used in the following code&nbsp;</p><pre>void setColorWheelColors(byte gRed, byte gGreen, byte gBlue) {<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>}</pre><p>I believe you're looking at older code. Here is my current working version as I've made that ColorArray change.</p><p>Here is my working code:</p><pre>#include &lt;EEPROM.h&gt;<br>#include "FastLED.h"<br>#include "EnableInterrupt.h" // must use this for internal interrupts<br>#define NUM_LEDS 20<br>#define PIN 6<br>#define EFFECT_BUTTON 3<br>#define COLOR_BUTTON 4<br>#define BRIGHTNESS_BUTTON 5<br>CRGB leds;<br>CRGB row1; // array used by colorWheel function<br>// Color       (HEX Code)          Array Position<br>// gGreen       (0x00, 0xFF, 0x00)  0,1,2<br>// gGreenCyan   (0x00, OxFF, 0x7F)  3,4,5<br>// Cyan        (0x00, 0xFF, 0xFF)  6,7,8<br>// gBlueCyan    (0x00, 0x7F, 0xFF)  9,10,11<br>// gBlue        (0x00, 0x00, 0xFF)  12,13,14<br>// gBlueMagenta (0x7F, 0x00, 0xFF)  15,16,17<br>// Magenta     (0xFF, 0x00, 0xFF)  18,19,20<br>// gRedMagenta  (0xFF, 0x00, 0x7F)  21,22,23<br>// gRed         (0xFF, 0x00, 0x00)  24,25,26<br>// Orange      (0xFF, 0x7F, 0x00)  27,28,29<br>// Yellow      (0xFF, 0xFF, 0x00)  30,31,32<br>// gGreenYellow (0x7F, 0xFF, 0x00)  33,34,35<br>// White       (0xFF, 0xFF, 0xFF)  36,37,38<br>byte ColorArray[] = {0x00, 0xFF, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0xFF, 0x00, 0xFF, 0xFF, 0xFF};<br>byte gRed = ColorArray;<br>byte gGreen = ColorArray;<br>byte gBlue = ColorArray;<br>byte selectedEffect = 0;<br>byte selectedColor = 0;<br>byte selectedBrightness = 0;<br>void setup() {<br>&nbsp; FastLED.addLeds&lt;WS2811, PIN, GRB&gt;(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );<br>&nbsp; pinMode (EFFECT_BUTTON, INPUT_PULLUP);  // internal pull-up resistor<br>&nbsp; pinMode (COLOR_BUTTON, INPUT_PULLUP);<br>&nbsp; pinMode (BRIGHTNESS_BUTTON, INPUT_PULLUP);<br>&nbsp; enableInterrupt(EFFECT_BUTTON, changeEffect, CHANGE); // EFFECT_BUTTON pressed<br>&nbsp; enableInterrupt(COLOR_BUTTON, changeColor, CHANGE); // COLOR_BUTTON pressed<br>&nbsp; enableInterrupt(BRIGHTNESS_BUTTON, changeBrightness, CHANGE); // BRIGHTNESS_BUTTON pressed<br>&nbsp; EEPROM.get(0, selectedEffect);<br>&nbsp; EEPROM.get(1, selectedColor);<br>&nbsp; EEPROM.get(2, selectedBrightness);<br>&nbsp; if (selectedEffect &gt; 12) {<br>&nbsp; &nbsp; selectedEffect = 0;<br>&nbsp; &nbsp; EEPROM.write(0, 0);<br>&nbsp; }<br>&nbsp; if (selectedColor &gt; 12) {<br>&nbsp; &nbsp; selectedColor = 0;<br>&nbsp; &nbsp; EEPROM.write(1, 0);<br>&nbsp; }<br>&nbsp; if (selectedBrightness &gt; 4) {<br>&nbsp; &nbsp; selectedBrightness = 0;<br>&nbsp; &nbsp; EEPROM.write(2, 0);<br>&nbsp; }<br>}<br>void loop() {<br>&nbsp; switch (selectedBrightness) {<br>&nbsp; &nbsp; case 0: {<br>&nbsp; &nbsp; &nbsp; &nbsp; LEDS.setBrightness(10);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 1: {<br>&nbsp; &nbsp; &nbsp; &nbsp; LEDS.setBrightness(25);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 2: {<br>&nbsp; &nbsp; &nbsp; &nbsp; LEDS.setBrightness(50);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 3: {<br>&nbsp; &nbsp; &nbsp; &nbsp; LEDS.setBrightness(100);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 4: {<br>&nbsp; &nbsp; &nbsp; &nbsp; LEDS.setBrightness(150);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; switch (selectedColor) {<br>&nbsp; &nbsp; case 0: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gGreen<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 1: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gGreenCyan<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 2: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // Cyan<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 3: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gBlueCyan<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 4: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gBlue<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 5: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gBlueMagenta<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 6: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // Magenta<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 7: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gRedMagenta<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 8: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // gRed<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 9: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // Orange<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 10: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // Yellow<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 11: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // YellowgGreen<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 12: {<br>&nbsp; &nbsp; &nbsp; &nbsp; // White<br>&nbsp; &nbsp; &nbsp; &nbsp; gRed = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gGreen = ColorArray;<br>&nbsp; &nbsp; &nbsp; &nbsp; gBlue = ColorArray;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; switch (selectedEffect) {<br>&nbsp; &nbsp; case 0  : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; fill_solid( leds, NUM_LEDS, CRGB(gRed, gGreen, gBlue) );<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 1  : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; setColorWheelColors(gRed, gGreen, gBlue);<br>&nbsp; &nbsp; &nbsp; &nbsp; // speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWheel(50);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 2 : {<br>&nbsp; &nbsp; &nbsp; &nbsp; // colorWipe - Color (red, green, blue), speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(gRed, gGreen, gBlue, 35);<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(0x00, 0x00, 0x00, 35); //turn leds off<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 3  : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // CylonBounce - Color (gRed, gGreen, gBlue), eye size, speed delay, end pause<br>&nbsp; &nbsp; &nbsp; &nbsp; CylonBounce(gRed, gGreen, gBlue, 3, 20, 0);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 4  : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // NewKITT - Color (gRed, gGreen, gBlue), eye size, speed delay, end pause<br>&nbsp; &nbsp; &nbsp; &nbsp; NewKITT(gRed, gGreen, gBlue, 3, 20, 50);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 5  : { // no color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // meteorRain - Color (gRed, gGreen, gBlue), meteor size, trail decay, random trail decay (true/false), speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; meteorRain(0xff, 0xff, 0xff, 1, 80, true, 25);<br>&nbsp; &nbsp; &nbsp; &nbsp; //meteorRain(gRed, gGreen, gBlue, 1, 80, true, 25);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 6  : { // no color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // Fire - Cooling rate, Sparking rate, speed delay 55,120,15<br>&nbsp; &nbsp; &nbsp; &nbsp; Fire(55, 120, 25);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 7 : { // no color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // FadeInOut - Color (Red, Green, Blue)<br>&nbsp; &nbsp; &nbsp; &nbsp; FadeInOut(0x00, 0x00, 0xFF); // Blue<br>&nbsp; &nbsp; &nbsp; &nbsp; FadeInOut(0xFF, 0x7F, 0x00); // Orange<br>&nbsp; &nbsp; &nbsp; &nbsp; FadeInOut(0x00, 0xFF, 0x00); // Green<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 8 : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // Strobe - Color (gRed, gGreen, gBlue), number of flashes, flash speed, end pause<br>&nbsp; &nbsp; &nbsp; &nbsp; Strobe(gRed, gGreen, gBlue, 10, 50, 750);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 9 : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // Sparkle - Color (gRed, gGreen, gBlue), speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; Sparkle(gRed, gGreen, gBlue, 0);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 10 : { // color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // Twinkle - Color (gRed, gGreen, gBlue), count, speed delay, only one twinkle (true/false)<br>&nbsp; &nbsp; &nbsp; &nbsp; Twinkle(gRed, gGreen, gBlue, 10, 100, false);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 11 : { // no color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // TwinkleRandom - twinkle count, speed delay, only one (true/false)<br>&nbsp; &nbsp; &nbsp; &nbsp; TwinkleRandom(20, 100, false);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; case 12 : { // no color change<br>&nbsp; &nbsp; &nbsp; &nbsp; // rainbowCycle - speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; rainbowCycle(20);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; }<br>}<br>void changeEffect() {<br>&nbsp; if (digitalRead (EFFECT_BUTTON) == HIGH) {<br>&nbsp; &nbsp; selectedEffect++;<br>&nbsp; &nbsp; EEPROM.put(0, selectedEffect);<br>&nbsp; &nbsp; asm volatile ("  jmp 0");<br>&nbsp; }<br>}<br>void changeColor() {<br>&nbsp; if (digitalRead (COLOR_BUTTON) == HIGH) {<br>&nbsp; &nbsp; selectedColor++;<br>&nbsp; &nbsp; EEPROM.put(1, selectedColor);<br>&nbsp; &nbsp; asm volatile ("  jmp 0");<br>&nbsp; }<br>}<br>void changeBrightness() {<br>&nbsp; if (digitalRead (BRIGHTNESS_BUTTON) == HIGH) {<br>&nbsp; &nbsp; selectedBrightness++;<br>&nbsp; &nbsp; EEPROM.put(2, selectedBrightness);<br>&nbsp; &nbsp; asm volatile ("  jmp 0");<br>&nbsp; }<br>}<br>// *************************<br>// ** LEDEffect Functions **<br>// *************************<br>void setColorWheelColors(byte gRed, byte gGreen, byte gBlue) {<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB(gRed, gGreen, gBlue);<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>&nbsp; row1 = CRGB::Black;<br>}<br>void colorWheel(int SpeedDelay) {<br>&nbsp; for (int j = 0; j &lt; NUM_LEDS; j++) {<br>&nbsp; &nbsp; assignTo(j);<br>&nbsp; &nbsp; //FastLED.show();<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>}<br>//used by colorWheel<br>void assignTo(int j) {<br>&nbsp; int i;<br>&nbsp; for (i = 0; i &lt; NUM_LEDS; i++)<br>&nbsp; {<br>&nbsp; &nbsp; leds<i> = row1;<br>&nbsp; }<br>}<br>void colorWipe(byte gRed, byte gGreen, byte gBlue, int SpeedDelay) {<br>&nbsp; for (uint16_t i = 0; i &lt; NUM_LEDS; i++) {<br>&nbsp; &nbsp; setPixel(i, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>}<br>void meteorRain(byte gRed, byte gGreen, byte gBlue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {<br>&nbsp; setAll(0, 0, 0);<br>&nbsp; for (int i = 0; i &lt; NUM_LEDS + NUM_LEDS; i++) {<br><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 );<br>&nbsp; &nbsp; &nbsp; }<br>&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, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>}<br>// used by meteorrain<br>void fadeToBlack(int ledNo, byte fadeValue) {<br>#ifdef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // NeoPixel<br>&nbsp; uint32_t oldColor;<br>&nbsp; uint8_t R, G, B;<br>&nbsp; int value;<br>&nbsp; oldColor = strip.getPixelColor(ledNo);<br>&nbsp; R = (oldColor &amp; 0x00ff0000UL) &gt;&gt; 16;<br>&nbsp; G = (oldColor &amp; 0x0000ff00UL) &gt;&gt; 8;<br>&nbsp; B = (oldColor &amp; 0x000000ffUL);<br>&nbsp; R = (R &lt;= 10) ? 0 : (int) R - (R * fadeValue / 256);<br>&nbsp; G = (G &lt;= 10) ? 0 : (int) G - (G * fadeValue / 256);<br>&nbsp; B = (B &lt;= 10) ? 0 : (int) B - (B * fadeValue / 256);<br>&nbsp; strip.setPixelColor(ledNo, R, G, B);<br>#endif<br>#ifndef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // FastLED<br>&nbsp; leds.fadeToBlackBy( fadeValue );<br>#endif<br>}<br>void NewKITT(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; RightToLeft(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; LeftToRight(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; OutsideToCenter(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; CenterToOutside(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; LeftToRight(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; RightToLeft(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; OutsideToCenter(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>&nbsp; CenterToOutside(gRed, gGreen, gBlue, EyeSize, SpeedDelay, ReturnDelay);<br>}<br>// used by NewKITT<br>void CenterToOutside(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; for (int i = ((NUM_LEDS - EyeSize) / 2); i &gt;= 0; i--) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; setPixel(NUM_LEDS - i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(NUM_LEDS - i - j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(NUM_LEDS - i - EyeSize - 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>}<br>// used by NewKITT<br>void OutsideToCenter(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; for (int i = 0; i &lt;= ((NUM_LEDS - EyeSize) / 2); i++) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; setPixel(NUM_LEDS - i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(NUM_LEDS - i - j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(NUM_LEDS - i - EyeSize - 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>}<br>// used by NewKITT<br>void LeftToRight(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; for (int i = 0; i &lt; NUM_LEDS - EyeSize - 2; i++) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>}<br>// used by NewKITT<br>void RightToLeft(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; for (int i = NUM_LEDS - EyeSize - 2; i &gt; 0; i--) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>}<br>void CylonBounce(byte gRed, byte gGreen, byte gBlue, int EyeSize, int SpeedDelay, int ReturnDelay) {<br>&nbsp; for (int i = 0; i &lt; NUM_LEDS - EyeSize - 2; i++) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>&nbsp; for (int i = NUM_LEDS - EyeSize - 2; i &gt; 0; i--) {<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; setPixel(i, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; for (int j = 1; j &lt;= EyeSize; j++) {<br>&nbsp; &nbsp; &nbsp; setPixel(i + j, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setPixel(i + EyeSize + 1, gRed / 10, gGreen / 10, gBlue / 10);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>&nbsp; delay(ReturnDelay);<br>}<br>void RunningLights(byte gRed, byte gGreen, byte gBlue, int WaveDelay) {<br>&nbsp; int Position = 0;<br>&nbsp; for (int i = 0; i &lt; NUM_LEDS * 2; i++)<br>&nbsp; {<br>&nbsp; &nbsp; Position++; // = 0; //Position + Rate;<br>&nbsp; &nbsp; for (int i = 0; i &lt; NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; // sine wave, 3 offset waves make a rainbow!<br>&nbsp; &nbsp; &nbsp; //float level = sin(i+Position) * 127 + 128;<br>&nbsp; &nbsp; &nbsp; //setPixel(i,level,0,0);<br>&nbsp; &nbsp; &nbsp; //float level = sin(i+Position) * 127 + 128;<br>&nbsp; &nbsp; &nbsp; setPixel(i, ((sin(i + Position) * 127 + 128) / 255)*gRed,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((sin(i + Position) * 127 + 128) / 255)*gGreen,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((sin(i + Position) * 127 + 128) / 255)*gBlue);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(WaveDelay);<br>&nbsp; }<br>}<br>void theaterChase(byte gRed, byte gGreen, byte gBlue, int SpeedDelay) {<br>&nbsp; for (int j = 0; j &lt; 10; j++) { //do 10 cycles of chasing<br>&nbsp; &nbsp; for (int q = 0; q &lt; 3; q++) {<br>&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; NUM_LEDS; i = i + 3) {<br>&nbsp; &nbsp; &nbsp; &nbsp; setPixel(i + q, gRed, gGreen, gBlue);  //turn every third pixel on<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; NUM_LEDS; i = i + 3) {<br>&nbsp; &nbsp; &nbsp; &nbsp; setPixel(i + q, 0, 0, 0);    //turn every third pixel off<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br>&nbsp; }<br>}<br>void Fire(int Cooling, int Sparking, int SpeedDelay) {<br>&nbsp; static byte heat;<br>&nbsp; int cooldown;<br>&nbsp; // Step 1.  Cool down every cell a little<br>&nbsp; for ( int i = 0; i &lt; NUM_LEDS; i++) {<br>&nbsp; &nbsp; cooldown = random(0, ((Cooling * 10) / NUM_LEDS) + 2);<br>&nbsp; &nbsp; if (cooldown &gt; heat<i>) {<br>&nbsp; &nbsp; &nbsp; heat<i> = 0;<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; heat<i> = heat<i> - cooldown;<br>&nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; // Step 2.  Heat from each cell drifts 'up' and diffuses a little<br>&nbsp; for ( int k = NUM_LEDS - 1; k &gt;= 2; k--) {<br>&nbsp; &nbsp; heat = (heat + heat + heat) / 3;<br>&nbsp; }<br>&nbsp; // Step 3.  Randomly ignite new 'sparks' near the bottom<br>&nbsp; if ( random(255) &lt; Sparking ) {<br>&nbsp; &nbsp; int y = random(7);<br>&nbsp; &nbsp; heat = heat + random(160, 255);<br>&nbsp; &nbsp; //heat = random(160,255);<br>&nbsp; }<br>&nbsp; // Step 4.  Convert heat to LED colors<br>&nbsp; for ( int j = 0; j &lt; NUM_LEDS; j++) {<br>&nbsp; &nbsp; setPixelHeatColor(j, heat );<br>&nbsp; }<br>&nbsp; showStrip();<br>&nbsp; delay(SpeedDelay);<br>}<br>//used by fire<br>void setPixelHeatColor (int Pixel, byte temperature) {<br>&nbsp; // Scale 'heat' down from 0-255 to 0-191<br>&nbsp; byte t192 = round((temperature / 255.0) * 191);<br>&nbsp; // calculate ramp up from<br>&nbsp; byte heatramp = t192 &amp; 0x3F; // 0..63<br>&nbsp; heatramp &lt;&lt;= 2; // scale up to 0..252<br>&nbsp; // figure out which third of the spectrum we're in:<br>&nbsp; if ( t192 &gt; 0x80) {                    // hottest<br>&nbsp; &nbsp; setPixel(Pixel, 255, 255, heatramp);<br>&nbsp; } else if ( t192 &gt; 0x40 ) {            // middle<br>&nbsp; &nbsp; setPixel(Pixel, 255, heatramp, 0);<br>&nbsp; } else {                               // coolest<br>&nbsp; &nbsp; setPixel(Pixel, heatramp, 0, 0);<br>&nbsp; }<br>}<br>void FadeInOut(byte gRed, byte gGreen, byte gBlue) {<br>&nbsp; float R, G, B;<br>&nbsp; for (int k = 0; k &lt; 256; k = k + 1) {<br>&nbsp; &nbsp; R = (k / 256.0) * gRed;<br>&nbsp; &nbsp; G = (k / 256.0) * gGreen;<br>&nbsp; &nbsp; B = (k / 256.0) * gBlue;<br>&nbsp; &nbsp; setAll(R, G, B);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; }<br>&nbsp; for (int k = 255; k &gt;= 0; k = k - 2) {<br>&nbsp; &nbsp; R = (k / 256.0) * gRed;<br>&nbsp; &nbsp; G = (k / 256.0) * gGreen;<br>&nbsp; &nbsp; B = (k / 256.0) * gBlue;<br>&nbsp; &nbsp; setAll(R, G, B);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; }<br>}<br>void Strobe(byte gRed, byte gGreen, byte gBlue, int StrobeCount, int FlashDelay, int EndPause) {<br>&nbsp; for (int j = 0; j &lt; StrobeCount; j++) {<br>&nbsp; &nbsp; setAll(gRed, gGreen, gBlue);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(FlashDelay);<br>&nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(FlashDelay);<br>&nbsp; }<br>&nbsp; delay(EndPause);<br>}<br>void Sparkle(byte gRed, byte gGreen, byte gBlue, int SpeedDelay) {<br>&nbsp; int Pixel = random(NUM_LEDS);<br>&nbsp; setPixel(Pixel, gRed, gGreen, gBlue);<br>&nbsp; showStrip();<br>&nbsp; delay(SpeedDelay);<br>&nbsp; setPixel(Pixel, 0, 0, 0);<br>}<br>void Twinkle(byte gRed, byte gGreen, byte gBlue, int Count, int SpeedDelay, boolean OnlyOne) {<br>&nbsp; setAll(0, 0, 0);<br>&nbsp; for (int i = 0; i &lt; Count; i++) {<br>&nbsp; &nbsp; setPixel(random(NUM_LEDS), gRed, gGreen, gBlue);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; &nbsp; if (OnlyOne) {<br>&nbsp; &nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; delay(SpeedDelay);<br>}<br>void TwinkleRandom(int Count, int SpeedDelay, boolean OnlyOne) {<br>&nbsp; setAll(0, 0, 0);<br>&nbsp; for (int i = 0; i &lt; Count; i++) {<br>&nbsp; &nbsp; setPixel(random(NUM_LEDS), random(0, 255), random(0, 255), random(0, 255));<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; &nbsp; if (OnlyOne) {<br>&nbsp; &nbsp; &nbsp; setAll(0, 0, 0);<br>&nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; delay(SpeedDelay);<br>}<br>void rainbowCycle(int SpeedDelay) {<br>&nbsp; byte *c;<br>&nbsp; uint16_t i, j;<br>&nbsp; for (j = 0; j &lt; 256 * 5; j++) { // 5 cycles of all colors on wheel<br>&nbsp; &nbsp; for (i = 0; i &lt; NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; c = Wheel(((i * 256 / NUM_LEDS) + j) &amp; 255);<br>&nbsp; &nbsp; &nbsp; setPixel(i, *c, *(c + 1), *(c + 2));<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }<br>}<br>// used by rainbowCycle<br>byte * Wheel(byte WheelPos) {<br>&nbsp; static byte c;<br>&nbsp; if (WheelPos &lt; 85) {<br>&nbsp; &nbsp; c = WheelPos * 3;<br>&nbsp; &nbsp; c = 255 - WheelPos * 3;<br>&nbsp; &nbsp; c = 0;<br>&nbsp; } else if (WheelPos &lt; 170) {<br>&nbsp; &nbsp; WheelPos -= 85;<br>&nbsp; &nbsp; c = 255 - WheelPos * 3;<br>&nbsp; &nbsp; c = 0;<br>&nbsp; &nbsp; c = WheelPos * 3;<br>&nbsp; } else {<br>&nbsp; &nbsp; WheelPos -= 170;<br>&nbsp; &nbsp; c = 0;<br>&nbsp; &nbsp; c = WheelPos * 3;<br>&nbsp; &nbsp; c = 255 - WheelPos * 3;<br>&nbsp; }<br>&nbsp; return c;<br>}<br><br><br><br>// ***************************************<br>// ** FastLed/NeoPixel Common Functions **<br>// ***************************************<br>// Apply LED color changes<br>void showStrip() {<br>#ifdef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // NeoPixel<br>&nbsp; strip.show();<br>#endif<br>#ifndef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // FastLED<br>&nbsp; FastLED.show();<br>#endif<br>}<br>// Set a LED color (not yet visible)<br>void setPixel(int Pixel, byte red, byte green, byte blue) {<br>#ifdef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // NeoPixel<br>&nbsp; strip.setPixelColor(Pixel, strip.Color(red, green, blue));<br>#endif<br>#ifndef ADAFRUIT_NEOPIXEL_H<br>&nbsp; // FastLED<br>&nbsp; leds.r = red;<br>&nbsp; leds.g = green;<br>&nbsp; leds.b = blue;<br>#endif<br>}<br>// Set all LEDs to a given color and apply it (visible)<br>void setAll(byte red, byte green, byte blue) {<br>&nbsp; for (int i = 0; i &lt; NUM_LEDS; i++ ) {<br>&nbsp; &nbsp; setPixel(i, red, green, blue);<br>&nbsp; }<br>&nbsp; showStrip();<br>}</pre><p><br></p><p><br></p><p><br></p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/#post-1578</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1577</link>
                        <pubDate>Fri, 17 May 2019 03:53:34 +0000</pubDate>
                        <description><![CDATA[Just something I just noticed, not necessarily cause of any problems you&#039;re experiencing; Maybe you overlooked the definition of the &quot;ColorArray&quot;. I know I did&nbsp; You&#039;ve assigned it a uin...]]></description>
                        <content:encoded><![CDATA[<p>Just something I just noticed, not necessarily cause of any problems you're experiencing; <br>Maybe you overlooked the definition of the "ColorArray". I know I did&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"> <br>You've assigned it a uint32_t type, where it should be byte.</p><pre><b>uint32_t</b> ColorArray[] = {0x00, ... 0xFF}; // should be: BYTE<br>byte Red = ColorArray;</pre><p>Maybe this was a leftover of earlier attempts where you wanted to store an color set (RGB = 32bit) as one value, versus separate red, green and blue (each a byte).<br>Since you assigned it an array of an integer type, the byte (for example 0x00) will be stored as a 32 bit integer (0x00000000).<br>Pulling an element as a byte, (byte Red = ColorArray;) will pull only the first byte of the 4 bytes you've stored.</p><p>Since the function theaterChase() is relatively "simple", I can't come up with scenarios where this is going sideways. Something else is interfering.<br>The odd part is that other, equally "simple" functions appear unaffected.</p><p>Another observation;&nbsp;&nbsp;I don't know where "<b>CRGB row1; // array used by colorWheel function</b>" came from ... <br>Is it a leftover from debugging? I'm not sure there is a need for it.</p><p>If I'd be debugging this code (I don't have my Arduino and LED strips handy), then I'd start by going back to the original code.<br>Sometimes it's good to start over (I do this quite often hahah).<br>Test if that works OK.</p><p>Then add the saving of selectedColor - you could even make a sketch that just toggles the EEPROM values, without any LED functions, just to see and follow what is happening there. Testing functions in small sketches, just for that specific function, is the way to go when things become complex or unexplainable things happen ...</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/troys-project/#post-1577</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1576</link>
                        <pubDate>Fri, 17 May 2019 00:43:50 +0000</pubDate>
                        <description><![CDATA[I&#039;ve been working on debugging theaterChase and i&#039;m completely confused by the function. Regardless of how I call the function it still presents weird behavior. I tried all of the previously...]]></description>
                        <content:encoded><![CDATA[I've been working on debugging theaterChase and i'm completely confused by the function. Regardless of how I call the function it still presents weird behavior. I tried all of the previously mentioned things but its not consistent on how it acts, which is rather odd. I think something in the function is conflicting with the code. Sometimes it will switch between cases, but usually it freezes on the part of the function that lights up every third led. However color changes will work with it, so if I load up the program while selectedEffect equals its case it will run and I can change colors. It breaks down on trying to switch between functions. Sometimes it would work if I pressed the button several times very fast but again, I can't get it to act consistently&nbsp; &nbsp; &nbsp;]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/#post-1576</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1575</link>
                        <pubDate>Fri, 17 May 2019 00:01:32 +0000</pubDate>
                        <description><![CDATA[Actually I think I just figured it out, I didn&#039;t realize that the second call of the function is turning the leds off!!!colorWipe(0x00, 0x00, 0x00, 50);so if I leave that line alone then the...]]></description>
                        <content:encoded><![CDATA[<p>Actually I think I just figured it out, I didn't realize that the second call of the function is turning the leds off!!!</p><pre>colorWipe(0x00, 0x00, 0x00, 50);</pre><p>so if I leave that line alone then the function works. I'm going to work on debugging the other two functions knowing what I know now, however they were acting different since they were freezing the program or causing the buttons to be unresponsive. I haven't tested those functions or the&nbsp; #define FASTLED_ALLOW_INTERRUPTS 0 with those functions yet so maybe there is still hope!&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><p><br></p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/#post-1575</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1574</link>
                        <pubDate>Thu, 16 May 2019 23:56:54 +0000</pubDate>
                        <description><![CDATA[Ok so here is the weird thing, colorWipe works when I change the call from&nbsp;case 12 : {&nbsp; &nbsp; &nbsp; &nbsp; // colorWipe - Color (red, green, blue), speed delay&nbsp; &nbsp; &amp;nbsp...]]></description>
                        <content:encoded><![CDATA[<p>Ok so here is the weird thing, colorWipe works when I change the call from&nbsp;</p><pre>case 12 : {<br>&nbsp; &nbsp; &nbsp; &nbsp; // colorWipe - Color (red, green, blue), speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(gRed, gGreen, gBlue, 50);<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(gRed, gGreen, gBlue, 50);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }</pre><p>to</p><pre>case 12 : {<br>&nbsp; &nbsp; &nbsp; &nbsp; // colorWipe - Color (red, green, blue), speed delay<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(0x00, 0xff, 0x00, 50);<br>&nbsp; &nbsp; &nbsp; &nbsp; colorWipe(0x00, 0x00, 0x00, 50);<br>&nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; }</pre><p><br></p><p>I didn't change the function within the program, so the first call works, here is the function within my code that has it working:&nbsp;</p><pre>void colorWipe(byte gRed, byte gGreen, byte gBlue, int SpeedDelay) {<br>&nbsp; for (uint16_t i = 0; i &lt; NUM_LEDS; i++) {<br>&nbsp; &nbsp; setPixel(i, gRed, gGreen, gBlue);<br>&nbsp; &nbsp; showStrip();<br>&nbsp; &nbsp; delay(SpeedDelay);<br>&nbsp; }</pre><p>So whatever is causing these functions to fail has to do with the function calls rather then the functions themselves, which would make sense given I haven't changed the functions. However I can't seem to understand the conflict regardless. The other functions work fine....<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_thinking.png" class="t4a_smiley" alt="" width="32" height="32" /> &nbsp;</p><p><br></p><p><br></p><p><br></p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/#post-1574</guid>
                    </item>
				                    <item>
                        <title>RE: Troy&#039;s project</title>
                        <link>https://www.tweaking4all.com/forum/arduino/troys-project/#post-1573</link>
                        <pubDate>Thu, 16 May 2019 22:50:04 +0000</pubDate>
                        <description><![CDATA[I changed my variables from volatile byte to byte but it didn&#039;t change how the EEPROM.put was overwriting the values. I had tried changing the addresses as well and still the same result. Fo...]]></description>
                        <content:encoded><![CDATA[I changed my variables from volatile byte to byte but it didn't change how the EEPROM.put was overwriting the values. I had tried changing the addresses as well and still the same result. Forwhatever reason EEPROM.write seems to be the only thing that works.<div><br></div><div>I made the suggested changes using&nbsp;&nbsp;</div><div><br></div><pre>#define FASTLED_ALLOW_INTERRUPTS 0</pre><div>before the FastLED library but it didn't change anything. colorWipe still refuses to loop, it only plays once and then the LEDs just sit there full lit....very strange indeed&nbsp;<img src="https://www.tweaking4all.com/wp-content/themes/tweaking4all/css/images/emoticons/t4a_confused.png" class="t4a_smiley" alt="" width="32" height="32" /> </div>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>troy89</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/troys-project/#post-1573</guid>
                    </item>
							        </channel>
        </rss>
		