<?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>
									Running light with push button - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 09 Jun 2026 03:23:22 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/paged/2/#post-1678</link>
                        <pubDate>Fri, 16 Aug 2019 07:06:05 +0000</pubDate>
                        <description><![CDATA[Awesome!&nbsp; For those visiting Tweaking4All; here the image on how to wire things and Robiv8&#039;s sketch.I still recommend checking out his Github page to make sure you have the latest versi...]]></description>
                        <content:encoded><![CDATA[<p>Awesome!&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><p>For those visiting Tweaking4All; here the image on how to wire things and Robiv8's sketch.<br>I still recommend checking out <a href="https://github.com/Robiv8/TurnSignal-WS2812B" target="_blank" rel="noopener noreferrer">his Github page</a> to make sure you have the latest version, and it would be good to read this thread to see how we got there.</p><p>Thanks again Robiv8!</p><div id="wpfa-12378" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="https://www.tweaking4all.com/wp-content/uploads/2019/08/TurnLight-BlinkerTestButtonFinal.png" target="_blank"><i class="fa fa-paperclip"></i>TurnLight-BlinkerTestButtonFinal.png</a></div><div id="wpfa-12379" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="https://www.tweaking4all.com/wp-content/uploads/2019/08/BlinkerTestButtonFinal.ino" target="_blank"><i class="fa fa-paperclip"></i>BlinkerTestButtonFinal.ino</a></div>]]></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/running-light-with-push-button/paged/2/#post-1678</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/paged/2/#post-1677</link>
                        <pubDate>Fri, 16 Aug 2019 06:34:53 +0000</pubDate>
                        <description><![CDATA[No, of course I do not mind. With pleasure.]]></description>
                        <content:encoded><![CDATA[<p>No, of course I do not mind. With pleasure.</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/paged/2/#post-1677</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1676</link>
                        <pubDate>Fri, 16 Aug 2019 04:11:21 +0000</pubDate>
                        <description><![CDATA[Thanks Robiv8!!Looks great! Well done! I&#039;m really liking this and curious what it will look like on your Vespa&nbsp; I encourage other readers to visit the Github link you provided (link).Wo...]]></description>
                        <content:encoded><![CDATA[<p>Thanks Robiv8!!</p><p>Looks great! Well done! I'm really liking this and curious what it will look like on your Vespa&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><p>I encourage other readers to visit the Github link you provided (<a href="https://github.com/Robiv8/TurnSignal-WS2812B" target="_blank" rel="noopener noreferrer">link</a>).</p><p>Would you mind if I post the picture and the sketch here as well?</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/running-light-with-push-button/#post-1676</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1675</link>
                        <pubDate>Thu, 15 Aug 2019 16:57:36 +0000</pubDate>
                        <description><![CDATA[And here on GitHubRobiv8/TurnSignal-WS2812B]]></description>
                        <content:encoded><![CDATA[<p>And here on GitHub</p><p><a href="https://github.com/Robiv8/TurnSignal-WS2812B">Robiv8/TurnSignal-WS2812B</a><br></p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1675</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1674</link>
                        <pubDate>Thu, 15 Aug 2019 12:57:29 +0000</pubDate>
                        <description><![CDATA[First of all a video how it works and looks.
72 LEDs each 36 for left and 36 for right.
Have it changed for two turn signals with an Arduino Nano.
Once I am in Croatia I will install it....]]></description>
                        <content:encoded><![CDATA[<p>First of all a video how it works and looks.</p>
<p>72 LEDs each 36 for left and 36 for right.</p>
<p>Have it changed for two turn signals with an Arduino Nano.</p>
<p>Once I am in Croatia I will install it.</p>
<p>Thanks again for your help.</p>
<p>https://www.youtube.com/watch?v=LjFCRdPBISA&amp;feature=youtu.be</p>
<p><a href="https://youtu.be/LjFCRdPBISA">YT Video</a></p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1674</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1667</link>
                        <pubDate>Mon, 12 Aug 2019 04:36:41 +0000</pubDate>
                        <description><![CDATA[Awesome! Glad this worked out for you!&nbsp; And if you ever make a little video of your Vespa; please let me know and/or post it here as well!&nbsp;]]></description>
                        <content:encoded><![CDATA[<p>Awesome! Glad this worked out for you!&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><p>And if you ever make a little video of your Vespa; please let me know and/or post it here as well!&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>]]></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/running-light-with-push-button/#post-1667</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1666</link>
                        <pubDate>Sun, 11 Aug 2019 14:56:36 +0000</pubDate>
                        <description><![CDATA[So here is the finished result as I wanted it.Perfect#define FASTLED_INTERNAL#include &quot;FastLED.h&quot;#include &lt;EEPROM.h&gt;#define NUM_LEDS 36&nbsp;#define blinkcount 3CRGB leds;#de...]]></description>
                        <content:encoded><![CDATA[<p>So here is the finished result as I wanted it.</p><p>Perfect</p><pre>#define FASTLED_INTERNAL<br>#include "FastLED.h"<br>#include &lt;EEPROM.h&gt;<br>#define NUM_LEDS 36&nbsp;<br>#define blinkcount 3<br>CRGB leds;<br>#define PIN 2&nbsp;<br>#define BUTTONLEFT  4<br>#define BUTTONRIGHT 5<br>byte selectedEffect   = 0;<br>int  buttonStateLeft  = 0;<br>int  buttonStateRight = 0;<br>bool AButtonPressed   = false;<br>bool DirectionCorrection = false;<br>void setup()<br>{<br>&nbsp; FastLED.addLeds&lt;WS2811, PIN, GRB&gt;(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );<br>&nbsp; pinMode(BUTTONLEFT,  INPUT);<br>&nbsp; pinMode(BUTTONRIGHT, INPUT);<br>&nbsp; LEDS.setBrightness(200);<br>}<br>void loop() {&nbsp;<br>&nbsp; buttonStateLeft  = digitalRead(BUTTONLEFT);<br>&nbsp; buttonStateRight = digitalRead(BUTTONRIGHT);<br>&nbsp; AButtonPressed = (buttonStateLeft == HIGH) || (buttonStateRight == HIGH);<br>&nbsp;&nbsp;<br>&nbsp; if (AButtonPressed) {<br>&nbsp; &nbsp; if(buttonStateLeft == HIGH) {<br>&nbsp; &nbsp; &nbsp; DirectionCorrection = 0;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; else {<br>&nbsp; &nbsp; &nbsp; DirectionCorrection = NUM_LEDS;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; for(int blink=0; blink&lt;blinkcount; blink++) {<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if(buttonStateLeft == HIGH) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds<i>.setRGB(255,130,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds.setRGB(255,130,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; // Instant black after swipe<br>&nbsp; &nbsp; &nbsp; setAll(0,0,0);<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setAll(0,0,0);<br>&nbsp; }<br>&nbsp; else {<br>&nbsp; &nbsp; setAll(0,0,0);<br>&nbsp; }<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; leds<i>.setRGB(red, green, blue);&nbsp;<br>&nbsp; }<br>&nbsp; FastLED.show();<br>}</pre>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1666</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1665</link>
                        <pubDate>Sun, 11 Aug 2019 14:30:07 +0000</pubDate>
                        <description><![CDATA[Many Thanks
&#039;DirectionCorrection&#039; was not declared in this scope ?Oh, I found it myself.I added that: bool DirectionCorrection = false;and it does.Thanks again]]></description>
                        <content:encoded><![CDATA[Many Thanks
<strike>'DirectionCorrection' was not declared in this scope ?</strike><div><strike><br></strike></div><div>Oh, I found it myself.</div><div>I added that: bool DirectionCorrection = false;</div><div>and it does.</div><div><br></div><div>Thanks again</div>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1665</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1664</link>
                        <pubDate>Sun, 11 Aug 2019 04:07:36 +0000</pubDate>
                        <description><![CDATA[Hi Robiv8!You&#039;re most welcome! Glad this is what you were looking for.To change direction, you&#039;ll just have to flip the direction,So these 2 for-loops:&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;...]]></description>
                        <content:encoded><![CDATA[<p>Hi Robiv8!</p><p>You're most welcome! Glad this is what you were looking for.</p><p>To change direction, you'll just have to flip the direction,<br>So these 2 for-loops:</p><pre>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; leds<i>.setRGB(255,50,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; //setAll(0,0,0);&nbsp;<br>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp;   leds<i>.setRGB(0,0,0);<br>&nbsp; &nbsp; &nbsp;   FastLED.show();<br>&nbsp; &nbsp; &nbsp;   delay(10);<br>&nbsp; &nbsp; &nbsp; }</pre><p>could become:</p><pre>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; leds.setRGB(255,50,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; //setAll(0,0,0);&nbsp;<br>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; leds.setRGB(0,0,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }</pre><p>(untested)</p><p>So combined, using 2 buttons (left and right), this may work (again: untested);</p><pre>#include "FastLED.h"<br>#include &lt;EEPROM.h&gt;<br>#define NUM_LEDS 60&nbsp;<br>#define blinkcount 5<br>CRGB leds;<br>#define PIN 6&nbsp;<br>#define BUTTONLEFT  2<br>#define BUTTONRIGHT 3<br>byte selectedEffect   = 0;<br>int  buttonStateLeft  = 0;<br>int  buttonStateRight = 0;<br>bool AButtonPressed   = false;<br>void setup()<br>{<br>&nbsp; FastLED.addLeds&lt;WS2811, PIN, GRB&gt;(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );<br>&nbsp; pinMode(BUTTONLEFT,  INPUT);<br>&nbsp; pinMode(BUTTONRIGHT, INPUT);<br>}<br>void loop() {&nbsp;<br>&nbsp; buttonStateLeft  = digitalRead(BUTTONLEFT);<br>&nbsp; buttonStateRight = digitalRead(BUTTONRIGHT);<br>&nbsp; AButtonPressed = (buttonStateLeft == HIGH) || (buttonStateRight == HIGH);<br>&nbsp;&nbsp;<br>&nbsp; if (AButtonPressed) {<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; if(buttonStateLeft == HIGH) {<br>&nbsp; &nbsp; &nbsp; DirectionCorrection = 0;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; else {<br>&nbsp; &nbsp; &nbsp; DirectionCorrection = NUM_LEDS;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; for(int blink=0; blink&lt;blinkcount; blink++) {<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if(buttonStateLeft == HIGH) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds<i>.setRGB(255,50,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds.setRGB(255,50,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; // Cleanup swipe after swipe<br>&nbsp; &nbsp; &nbsp; //setAll(0,0,0);<br>&nbsp; &nbsp; &nbsp; for(int i=0; i&lt;NUM_LEDS; i++) {<br>&nbsp; &nbsp; &nbsp; &nbsp; if(buttonStateLeft == HIGH) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds<i>.setRGB(0,0,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leds.setRGB(0,0,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; FastLED.show();<br>&nbsp; &nbsp; &nbsp; &nbsp; delay(10);<br>&nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; delay(200);<br>&nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; setAll(0,0,0);<br>&nbsp; }<br>&nbsp; else {<br>&nbsp; &nbsp; setAll(0,0,0);<br>&nbsp; }<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; leds<i>.setRGB(red, green, blue);&nbsp;<br>&nbsp; }<br>&nbsp; FastLED.show();<br>}</pre><p>Hope this helps ... and if you're done with your Vespa, please feel free to share the end result here&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/running-light-with-push-button/#post-1664</guid>
                    </item>
				                    <item>
                        <title>RE: Running light with push button</title>
                        <link>https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1663</link>
                        <pubDate>Sat, 10 Aug 2019 15:14:50 +0000</pubDate>
                        <description><![CDATA[That&#039;s exactly what I wanted.Great support, thank you very much.I dare not ask how I can change direction. Now from right to left to left to right.]]></description>
                        <content:encoded><![CDATA[<p>That's exactly what I wanted.<br>Great support, thank you very much.</p><p>I dare not ask how I can change direction. Now from right to left to left to right.</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>robiv8</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/running-light-with-push-button/#post-1663</guid>
                    </item>
							        </channel>
        </rss>
		