<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — LED Fading]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=565</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=565&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in LED Fading.]]></description>
		<lastBuildDate>Sun, 09 Sep 2018 15:01:52 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: LED Fading]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=1787#p1787</link>
			<description><![CDATA[<p>Well the code is in a loop, so it will continue looping....</p><p>the &quot;for&quot; statement starts helligkeit&nbsp; at value 1, then that is written to the ledPin.</p><p>A small delay is executed, then helligkeit is incremented by 2, and then the new value is written to the PWM pin.</p><p>This repeats itself until helligkeit increments beyond 255.</p><p>Then the code repeats itself, all over again.</p><p>If you want to control the brightness of your LED with RemoteXY, there&#039;s a couple of ways you could do it.</p><br /><p>1. Easiest way is to use a Slider control. These send a value of 0..100 to the controller, which you can then map to the 0..255 PWM pin with :-</p><div class="codebox"><pre><code>analogWrite(ledPin, (map(slider_value, 0, 100, 0, 255)));</code></pre></div><br /><p>2. Use buttons to &quot;bump&quot; the ledPin value Up and Down by a certain amount (your choice) each time the buttons are pressed.&nbsp; e.g.</p><div class="codebox"><pre><code>if (RemoteXY.buttonUp) {
 RemoteXY.buttonUp = 0;
 ledPin_value = ledPin_value + 5;
 delay(100);
}</code></pre></div><p>do the same for .buttonDown ( ledPin_value -5 ! )</p><p>then check that ledPin_value is within limits for the PWM ( 0-255 );</p><div class="codebox"><pre><code>constrain(ledPin_value, 0, 255);</code></pre></div><p>then write the value to the PWM pin.<br /></p><div class="codebox"><pre><code>analogWrite(ledPin, ledPin_value);</code></pre></div><p>You&#039;ll notice that I immediately write the button value back to zero as soon as I &quot;see&quot; it. This is to stop the button being acted on repeatedly until the RemoteXY interface resets it back to zero. Without it, you&#039;ll almost certainly get &quot;overshoot&quot;, unless that delay(100) is much, much larger.</p><p>Have fun....</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Sun, 09 Sep 2018 15:01:52 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=1787#p1787</guid>
		</item>
		<item>
			<title><![CDATA[LED Fading]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=1779#p1779</link>
			<description><![CDATA[<p>Hi everybody,</p><p>with a control button, I would like to dim an LED:</p><p>This works without Problems:</p><p>void loop()<br />{<br />&nbsp; for (int helligkeit =1; helligkeit &lt;= 255; helligkeit = helligkeit +2)<br />&nbsp; {<br />&nbsp; &nbsp; analogWrite(ledPin, helligkeit);<br />&nbsp; &nbsp; delay(10);<br />&nbsp; }</p><p>But, as soon as I initiate this routine by a Remotexy button, it seems, a loop is processed (LED is dimmed down to 0, then starts again from the beginning). Does somebody has any idea?</p><p>Thanks!!!!</p>]]></description>
			<author><![CDATA[null@example.com (testapps)]]></author>
			<pubDate>Mon, 03 Sep 2018 15:01:39 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=1779#p1779</guid>
		</item>
	</channel>
</rss>
