<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Arduino statement constrain(ledPinVal, 0, 255); doesn't work on Remote]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1373&amp;type=atom" />
	<updated>2021-08-31T22:04:00Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1373</id>
		<entry>
			<title type="html"><![CDATA[Re: Arduino statement constrain(ledPinVal, 0, 255); doesn't work on Remote]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=4217#p4217" />
			<content type="html"><![CDATA[<p>Thank you for your prompt reply. Yes, it works. Using constrain as suggested by you saved me a lot a coding. I love your RemoteXY. I have tried the MIT App inventor, Blynk and RoboRemo, but <strong>RemoteXY takes the GOLD</strong>. Thanks again from Sydney, Australia.</p>]]></content>
			<author>
				<name><![CDATA[Mahen@Oz]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1907</uri>
			</author>
			<updated>2021-08-31T22:04:00Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=4217#p4217</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Arduino statement constrain(ledPinVal, 0, 255); doesn't work on Remote]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=4216#p4216" />
			<content type="html"><![CDATA[<p>Hello</p><p>constrain doesn&#039;t modify the variable that you pass in it, instead it returns a new value, so must be used like this:<br /></p><div class="codebox"><pre><code>ledPinVal = constrain( ledPinVal, 0, 255 );</code></pre></div><p>Or, using if statement:<br /></p><div class="codebox"><pre><code>if ( ledPinVal &lt; 0 )
{
  ledPinVal = 0;
}
else if ( ledPinVal &gt; 255 )
{
  ledPinVal = 255;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Guillaume]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=23</uri>
			</author>
			<updated>2021-08-31T15:52:02Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=4216#p4216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Arduino statement constrain(ledPinVal, 0, 255); doesn't work on Remote]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=4215#p4215" />
			<content type="html"><![CDATA[<p>With the up/down button to increase/degrease a value within the limit 0-255, the Arduino statement </p><p>constrain(ledPinVal, 0, 255); doesn&#039;t limit the value to 255. It keeps going up &gt;255 and &lt;0 as well.</p><p>But this statement </p><p>if (ledPinVal &lt;= 0 || ledPinVal &gt;= 255) {<br />&nbsp; ledPinVal=255;//works.</p><p>Same for </p><p>if (ledPinVal &lt;= 0 || ledPinVal &gt;= 255) {<br />&nbsp; ledPinVal=0;//works</p>]]></content>
			<author>
				<name><![CDATA[Mahen@Oz]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1907</uri>
			</author>
			<updated>2021-08-31T08:55:13Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=4215#p4215</id>
		</entry>
</feed>
