<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — reconnect cloud server]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=1005</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1005&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in reconnect cloud server.]]></description>
		<lastBuildDate>Sun, 17 May 2020 08:41:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[reconnect cloud server]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=2959#p2959</link>
			<description><![CDATA[<p>Connection solutions cloud server</p><br /><p>/*<br />&nbsp; &nbsp;-- 0000 --<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;This source code of graphical user interface <br />&nbsp; &nbsp;has been generated automatically by RemoteXY editor.<br />&nbsp; &nbsp;To compile this code using RemoteXY library 2.4.3 or later version <br />&nbsp; &nbsp;download by link <a target="_blank" href="http://remotexy.com/en/library/">http://remotexy.com/en/library/</a><br />&nbsp; &nbsp;To connect using RemoteXY mobile app by link <a target="_blank" href="http://remotexy.com/en/download/">http://remotexy.com/en/download/</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp;- for ANDROID 4.5.1 or later version;<br />&nbsp; &nbsp; &nbsp;- for iOS 1.4.1 or later version;<br />&nbsp; &nbsp; <br />&nbsp; &nbsp;This source code is free software; you can redistribute it and/or<br />&nbsp; &nbsp;modify it under the terms of the GNU Lesser General Public<br />&nbsp; &nbsp;License as published by the Free Software Foundation; either<br />&nbsp; &nbsp;version 2.1 of the License, or (at your option) any later version.&nbsp; &nbsp; <br />*/</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_CLOUD<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_PASS&quot;<br />#define REMOTEXY_CLOUD_SERVER &quot;cloud.remotexy.com&quot;<br />#define REMOTEXY_CLOUD_PORT 6376<br />#define REMOTEXY_CLOUD_TOKEN &quot;YOUR_TOKEN&quot;<br />#define REMOTEXY_ACCESS_PASSWORD &quot;1234&quot;</p><p>// RemoteXY configurate&nbsp; <br />#pragma pack(push, 1)<br />uint8_t RemoteXY_CONF[] =<br />&nbsp; { 255,1,0,3,0,24,0,10,24,1,<br />&nbsp; 65,23,10,36,39,39,1,4,11,37,<br />&nbsp; 37,37,25,31,79,78,45,79,70,70,<br />&nbsp; 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_r; // =0..255 LED Red brightness <br />&nbsp; uint8_t led_1_g; // =0..255 LED Green brightness <br />&nbsp; uint8_t led_1_b; // =0..255 LED Blue 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 D4<br />bool wfconnect;<br />bool Switch1 = false;<br />WiFiClient CloudRemoteXY;<br />unsigned long timesevercheck = 0;</p><p>void cloudchecker(){<br />&nbsp; int retxycloudserver = CloudRemoteXY.connect(REMOTEXY_CLOUD_SERVER,REMOTEXY_CLOUD_PORT);<br />&nbsp; if ( retxycloudserver == 1 ) {<br />&nbsp; &nbsp; &nbsp;Serial.print(&quot;cloud Connected.&quot;);<br />&nbsp; &nbsp; &nbsp;}else{<br />&nbsp; &nbsp; &nbsp;Serial.print(&quot;cloud NOT Connect.&quot;);<br />&nbsp; &nbsp; &nbsp;remotexy = new CRemoteXY (RemoteXY_CONF_PROGMEM, &amp;RemoteXY, REMOTEXY_ACCESS_PASSWORD, REMOTEXY_WIFI_SSID, REMOTEXY_WIFI_PASSWORD, REMOTEXY_CLOUD_SERVER, REMOTEXY_CLOUD_PORT, REMOTEXY_CLOUD_TOKEN);<br />&nbsp; &nbsp; &nbsp;wfconnect = false;<br />&nbsp; &nbsp; &nbsp;Serial.print(&quot;Reconnect cloud server&quot;);<br />&nbsp; &nbsp; &nbsp;}<br />}</p><br /><p>void setup(){<br />&nbsp; &nbsp; Serial.begin(115200);<br />&nbsp; &nbsp; //RemoteXY_Init (); <br />&nbsp; <br />&nbsp; &nbsp; &nbsp;pinMode (PIN_BUTTON_1, OUTPUT);<br />&nbsp; &nbsp; &nbsp;remotexy = new CRemoteXY (RemoteXY_CONF_PROGMEM, &amp;RemoteXY, REMOTEXY_ACCESS_PASSWORD, REMOTEXY_WIFI_SSID, REMOTEXY_WIFI_PASSWORD, REMOTEXY_CLOUD_SERVER, REMOTEXY_CLOUD_PORT, REMOTEXY_CLOUD_TOKEN);<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; // TODO you setup code<br />&nbsp; &nbsp; RemoteXY.led_1_b = 255; <br />&nbsp; &nbsp; &nbsp;if ( WiFi.status() == WL_CONNECTED ) {<br />&nbsp; &nbsp; &nbsp;wfconnect = true;<br />&nbsp; &nbsp; &nbsp;Serial.print(&quot;Wifi Connected.&quot;);<br />&nbsp; &nbsp; &nbsp;}<br />&nbsp; timesevercheck = millis();&nbsp; <br />}</p><p>void loop() <br />{ <br />&nbsp; RemoteXY_Handler ();<br /> //wifi checker &amp; reconnect to remotexy<br /> if(wfconnect == true){<br />&nbsp; &nbsp; &nbsp; if ( WiFi.status() != WL_CONNECTED ) {<br />&nbsp; &nbsp; &nbsp; remotexy = new CRemoteXY (RemoteXY_CONF_PROGMEM, &amp;RemoteXY, REMOTEXY_ACCESS_PASSWORD, REMOTEXY_WIFI_SSID, REMOTEXY_WIFI_PASSWORD, REMOTEXY_CLOUD_SERVER, REMOTEXY_CLOUD_PORT, REMOTEXY_CLOUD_TOKEN);<br />&nbsp; &nbsp; &nbsp; wfconnect = false;<br />&nbsp; &nbsp; &nbsp; Serial.println(&quot;Wifi DisConnected.&quot;);<br />&nbsp; &nbsp; &nbsp; Serial.println(&quot;Wifi Reonnect&quot;);<br />&nbsp; &nbsp; &nbsp; }<br />&nbsp; }else if(wfconnect == false){&nbsp; &nbsp; <br />&nbsp; &nbsp; if ( WiFi.status() == WL_CONNECTED ) {<br />&nbsp; &nbsp; &nbsp;wfconnect = true;<br />&nbsp; &nbsp; &nbsp;Serial.println(&quot;Wifi ReConnected.&quot;);<br />&nbsp; &nbsp; &nbsp;Serial.println( F(&quot;My IP address: &quot;));<br />&nbsp; &nbsp; &nbsp;Serial.println(WiFi.localIP());<br />&nbsp; &nbsp; &nbsp;} <br />&nbsp; }<br /> ///server cloudchecker<br /> if ( (millis() - timesevercheck &gt;= 60000 )) {<br />&nbsp; &nbsp; &nbsp;Serial.println(&quot;sever checker&quot;);&nbsp; <br />&nbsp; &nbsp; &nbsp;cloudchecker();<br />&nbsp; &nbsp; &nbsp;timesevercheck = millis();<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; }</p><br /><p>&nbsp; digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1==0)?LOW:HIGH);</p><p>&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 (tmix_music)]]></author>
			<pubDate>Sun, 17 May 2020 08:41:41 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=2959#p2959</guid>
		</item>
	</channel>
</rss>
