<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — illuminate button]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=1138</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1138&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in illuminate button.]]></description>
		<lastBuildDate>Tue, 11 Aug 2020 06:16:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3287#p3287</link>
			<description><![CDATA[<div class="quotebox"><cite>Joan wrote:</cite><blockquote><div class="quotebox"><cite>Daba wrote:</cite><blockquote><p>I believe it consume less memory, and possibly easier to understand...</p></blockquote></div><p>Congratulations!!! Your code is brilliant. I will rehearse it.</p><p>IN CCS I use the toggle function, but in Arduino it doesn&#039;t exist and that&#039;s why I made this little code.</p><p>Sorry,<br />where i find ... #include&nbsp; ---&gt; &quot;RemoteXY.hpp&quot;</p><br /><br /><p>Thank you!!!!</p></blockquote></div><p>RemoteXY.hpp is the name of a separate &quot;tab&quot; which contains the source code copied from the web editor.</p><p>Using a separate tab makes it easier to update, because once you have copied the source code, you can then go into that tab, do a ctrl-a (select all), then ctrl-v (paste). </p><p>The button to create a new tab is on the right of the IDE, just below the serial monitor button.</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Tue, 11 Aug 2020 06:16:00 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3287#p3287</guid>
		</item>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3286#p3286</link>
			<description><![CDATA[<div class="quotebox"><cite>Daba wrote:</cite><blockquote><p>I believe it consume less memory, and possibly easier to understand...</p></blockquote></div><p>Congratulations!!! Your code is brilliant. I will rehearse it.</p><p>IN CCS I use the toggle function, but in Arduino it doesn&#039;t exist and that&#039;s why I made this little code.</p><p>Sorry,<br />where i find ... #include&nbsp; ---&gt; &quot;RemoteXY.hpp&quot;</p><br /><br /><p>Thank you!!!!</p>]]></description>
			<author><![CDATA[null@example.com (Joan)]]></author>
			<pubDate>Mon, 10 Aug 2020 16:46:50 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3286#p3286</guid>
		</item>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3285#p3285</link>
			<description><![CDATA[<p>I execute the &quot;toggle&quot; function needed by a Push_ON/Push_OFF (latching) button slightly differently, I believe it consume less memory, and possibly easier to understand....</p><div class="codebox"><pre><code>#include &quot;RemoteXY.hpp&quot;

// program variables
bool  button1;        // momentary button
bool  button2;        // latching button
bool  button2_memory;


void setup() 
{
  RemoteXY_Init (); 
}

void loop() 
{ 
  RemoteXY_Handler ();
  
  // Momentary button is easy....
  // the boolean tag button1 will be true if
  // the input data is non-zero
  button1 = RemoteXY.button1;

  // Latching button is a little harder ....
  // test to see if button is pressed
  if(RemoteXY.button2) {
    // now test if not already seen on
    if(!button2_memory) {
      // a new press, so toggle the button
      button2 = !button2;
      // set memory flag as button seen
      button2_memory = true;
    }
  }
  // reset the memory flag when button released
  if(!RemoteXY.button2) button2_memory = false;

  // now drive the LED indicators from the button states
  // each button will be either 0 or 1
  RemoteXY.led1_r = (button1 * 255);
  RemoteXY.led2_r = (button2 * 255);
  
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Mon, 10 Aug 2020 12:12:42 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3285#p3285</guid>
		</item>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3278#p3278</link>
			<description><![CDATA[<p>This is my example:</p><p><a target="_blank" href="http://remotexy.com/en/editor/922181bfa38d9f062c54be4b3b215c09/">http://remotexy.com/en/editor/922181bfa … b3b215c09/</a></p><p>And the code:</p><p>//////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; RemoteXY include library&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />//////////////////////////////////////////////</p><p>// RemoteXY select connection mode and include library <br />#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT<br />#include &lt;ESP8266WiFi.h&gt;</p><p>#include &lt;RemoteXY.h&gt;</p><p>// RemoteXY connection settings <br />#define REMOTEXY_WIFI_SSID &quot;your ssid&quot;<br />#define REMOTEXY_WIFI_PASSWORD &quot;your password&quot;<br />#define REMOTEXY_SERVER_PORT 6377</p><p>uint8_t flag1;<br />uint8_t val01;</p><br /><p>// RemoteXY configurate&nbsp; <br />#pragma pack(push, 1)<br />uint8_t RemoteXY_CONF[] =<br />&nbsp; { 255,1,0,1,0,33,0,10,13,1,<br />&nbsp; 1,1,22,22,17,17,29,133,0,65,<br />&nbsp; 26,23,23,15,15,129,0,21,6,21,<br />&nbsp; 6,6,82,101,108,101,32,48,49,0 };<br />&nbsp; <br />// this structure defines all the variables and events of your control interface <br />struct {</p><p>&nbsp; &nbsp; // input variables<br />&nbsp; uint8_t button_1; // =1 if button pressed, else =0 </p><p>&nbsp; &nbsp; // output variables<br />&nbsp; uint8_t led_1_g; // =0..255 LED Green brightness </p><p>&nbsp; &nbsp; // other variable<br />&nbsp; uint8_t connect_flag;&nbsp; // =1 if wire connected, else =0 </p><p>} RemoteXY;<br />#pragma pack(pop)</p><p>/////////////////////////////////////////////<br />//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;END RemoteXY include&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //<br />/////////////////////////////////////////////</p><p>// #define PIN_BUTTON_1 D2&nbsp; &nbsp; // For NodeMCU V3<br />#define PIN_BUTTON_1 2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // For ESP8266-01</p><br /><p>void setup() <br />{<br />&nbsp; RemoteXY_Init (); <br />&nbsp; <br />&nbsp; pinMode (PIN_BUTTON_1, OUTPUT);<br />&nbsp; <br />&nbsp; // TODO you setup code<br />&nbsp; <br />}</p><p>void loop() <br />{ <br />&nbsp; RemoteXY_Handler ();<br />&nbsp; <br />&nbsp; if (RemoteXY.button_1==0) flag1=0; // Detects the change of state of the button.<br />&nbsp; if ((RemoteXY.button_1==1) &amp;&amp; flag1==0){<br />&nbsp; &nbsp; if (val01==1){<br />&nbsp; &nbsp; &nbsp; val01=0;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else{<br />&nbsp; &nbsp; &nbsp; val01=1;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; flag1=1;<br />&nbsp; &nbsp; digitalWrite(PIN_BUTTON_1, val01);<br />&nbsp; &nbsp; }<br />&nbsp; <br />&nbsp; &nbsp;<br />&nbsp; RemoteXY.led_1_g = (digitalRead(2)==HIGH)?255:0;&nbsp; <br />&nbsp; <br />&nbsp; // TODO you loop code<br />&nbsp; // use the RemoteXY structure for data transfer<br />&nbsp; // do not call delay() </p><br /><p>}</p>]]></description>
			<author><![CDATA[null@example.com (Joan)]]></author>
			<pubDate>Sun, 09 Aug 2020 21:59:48 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3278#p3278</guid>
		</item>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3276#p3276</link>
			<description><![CDATA[<p>OK Daba...<br />Yesterday I made a similar one and I put a code where it turns on when you press, maintains the state and turns off when you press again. SonOff type.</p><p>I was saying it because that way we only use one element and not two.<br />Thanks for the example.</p>]]></description>
			<author><![CDATA[null@example.com (Joan)]]></author>
			<pubDate>Sun, 09 Aug 2020 17:44:34 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3276#p3276</guid>
		</item>
		<item>
			<title><![CDATA[Re: illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3271#p3271</link>
			<description><![CDATA[<div class="quotebox"><cite>Joan wrote:</cite><blockquote><p>illuminate button.</p><p>Like we illuminate an LED, it would be nice to be able to illuminate a button.<br />If we have an application that when pressing the button turns on a relay and when pressing it again we turn it off, it is good to indicate it from the same button.</p><br /><p>Sorry, if it&#039;s not in this space, please move it.</p><br /><p>Thank you.</p></blockquote></div><p>Welcome to the forum Joan...</p><p>Place the button behind an LED (it will still work!), use the &quot;To Front&quot;, &quot;Forward One&quot;, &quot;Back One&quot;, and &quot;To Back&quot; menu controls to get the LED in front of the button.</p><p>Obviously you will have to write code in the sketch to &quot;illuminate&quot; the LED (Dark Red, Bright Red, for example....).</p><p>Remember that the button is the same as a physical button, and the phone app. will keep on writing a &quot;1&quot; to the button value as long as your finger is on it, only writing a &quot;0&quot; when your finger is removed. You will have to take care of this in code.</p><p>Here, I&#039;ve just made this to show you...</p><p><a target="_blank" href="http://remotexy.com/en/editor/d92747f372c5f85458d5c5e5f28c0875/">http://remotexy.com/en/editor/d92747f37 … 5f28c0875/</a></p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Sun, 09 Aug 2020 10:10:23 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3271#p3271</guid>
		</item>
		<item>
			<title><![CDATA[illuminate button]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3268#p3268</link>
			<description><![CDATA[<p>illuminate button.</p><p>Like we illuminate an LED, it would be nice to be able to illuminate a button.<br />If we have an application that when pressing the button turns on a relay and when pressing it again we turn it off, it is good to indicate it from the same button.</p><br /><p>Sorry, if it&#039;s not in this space, please move it.</p><br /><p>Thank you.</p>]]></description>
			<author><![CDATA[null@example.com (Joan)]]></author>
			<pubDate>Sun, 09 Aug 2020 05:49:25 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3268#p3268</guid>
		</item>
	</channel>
</rss>
