<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Values from second ESP]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=41&amp;type=atom" />
	<updated>2018-03-11T13:50:55Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=41</id>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1385#p1385" />
			<content type="html"><![CDATA[<p>Hello,<br />I have same issue, I want to read the data from many other ESP8266 and send it to RemoteXY from one ESP1 which is connected as shield on MEGA.</p><p>So I started from setting the communication between two ESP by using router. This example works:<br /><a target="_blank" href="http://www.instructables.com/id/WiFi-Communication-Between-Two-ESP8266-Based-MCU-T/">http://www.instructables.com/id/WiFi-Co … sed-MCU-T/</a></p><p>I create few servers(these are virtual servers, I think) who send the data to 1 client&nbsp; - ESP1. But when I want to set RemoteXY also on ESP1 it don&#039;t work together at all. <br />Here can see my code, it not read data from other servers and do not connect to RemoteXY too.<br />Whit mark <em>//R: WiFIEsp</em>&nbsp; I show the place were I add commands to set connection to server.</p><p>Maybe it is because, WiFiEsp library do not work together with Remote XY.</p><div class="codebox"><pre><code>/* 
   -- mega esp -- 
   
   DHT:   MEGA:
   dat    52
*/ 

#define REMOTEXY_MODE__ESP8266_HARDSERIAL_CLOUD
#include &lt;RemoteXY.h&gt; 
#include &lt;SimpleDHT.h&gt; //R: DHT:
#include &quot;WiFiEsp.h&quot; //R: WiFiEsp

// настройки соединения 
 
#define REMOTEXY_SERIAL Serial1 // R: tas ir tie 19 un 18 pini

#define REMOTEXY_SERIAL_SPEED 9600 
#define REMOTEXY_WIFI_SSID &quot;XX_3_5&quot; 
#define REMOTEXY_WIFI_PASSWORD &quot;XXXXXX&quot; 
#define REMOTEXY_CLOUD_SERVER &quot;cloud.remotexy.com&quot; 
#define REMOTEXY_CLOUD_PORT XXXX 
#define REMOTEXY_CLOUD_TOKEN &quot;XXXXX&quot; 


// конфигурация интерфейса   
#pragma pack(push, 1) 
uint8_t RemoteXY_CONF[] = 
  { 255,2,0,24,0,177,0,8,186,1,
  2,0,3,52,22,11,2,26,31,31,
  79,78,0,79,70,70,0,129,0,4,
  47,13,3,29,109,101,103,97,32,108,
  101,100,0,67,4,4,12,16,5,2,
  26,6,129,0,4,7,17,3,29,109,
  101,103,97,32,116,101,109,112,46,0,
  67,4,4,25,16,5,2,26,6,129,
  0,4,21,16,3,29,109,101,103,97,
  32,109,105,116,114,46,0,67,4,38,
  12,16,5,2,26,6,67,4,38,25,
  16,5,2,26,6,129,0,38,8,16,
  3,29,101,115,112,50,32,116,101,109,
  112,46,0,129,0,38,21,15,3,29,
  101,115,112,51,32,109,105,116,114,46,
  0,2,0,38,52,22,11,2,26,31,
  31,79,78,0,79,70,70,0,129,0,
  39,47,13,3,29,101,115,112,50,32,
  108,101,100,0 }; 
   
// структура определяет все переменные вашего интерфейса управления  
struct { 

    // input variable
  uint8_t mega_led; // =1 если переключатель включен и =0 если отключен 
  uint8_t esp2_led; // =1 если переключатель включен и =0 если отключен 

    // output variable
  char temp_mega[6];  // =строка UTF8 оканчивающаяся нулем 
  char hum_mega[6];  // =строка UTF8 оканчивающаяся нулем 
  char temp_esp2[6];  // =строка UTF8 оканчивающаяся нулем 
  char hum_esp3[6];  // =строка UTF8 оканчивающаяся нулем 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY; 
#pragma pack(pop) 

#define PIN_MEGA_LED 13
#define PIN_ESP2_LED 12//R: jalabo
//-----------------------------------------------------
//R: DHT pins:
int pinDHT22 = 52;
SimpleDHT22 dht22;
//-----------------------------------------------------
//R: WiFiEsp
int status = WL_IDLE_STATUS;
IPAddress serverESP2(192, 168, 8, 110);       // the fix IP address of the server

// Initialize the Ethernet client object
WiFiEspClient client;

void setup()  
{ 
  RemoteXY_Init ();     
  pinMode (PIN_MEGA_LED, OUTPUT);
  pinMode (PIN_ESP2_LED, OUTPUT);
 //-----------------------------------------------------
//R: WiFiEsp  

   // initialize serial for debugging
  Serial.begin(9600);
  // initialize serial for ESP module
  Serial1.begin(9600);
  /*
  // initialize ESP module
  WiFi.init(&amp;Serial1);  //R: As soon as I add it the remotexy don&#039;t work
*/ 
} 

void loop()  
{  
  RemoteXY_Handler (); 
   
  digitalWrite(PIN_MEGA_LED, (RemoteXY.mega_led==0)?LOW:HIGH);
  digitalWrite(PIN_ESP2_LED, (RemoteXY.esp2_led==0)?LOW:HIGH);
   
  // TODO you loop code 
  
  //R: DHT:
     float temperature = 0;
     float humidity = 0;
       int err = SimpleDHTErrSuccess;
     if ((err = dht22.read2(pinDHT22, &amp;temperature, &amp;humidity, NULL)) != SimpleDHTErrSuccess) {
     //delay(300);
     return;
      } 
 
/*  R: sending temp. un hum. to app:
    преобразуем значение температуры в строку  
    и помещаем ее сразу в поле temp un hum структуры RemoteXY */ 
   dtostrf((float)temperature, 0, 1, RemoteXY.temp_mega);
   dtostrf((float)humidity, 0, 1, RemoteXY.hum_mega);

//-----------------------------------------------------------------------------------------
//R: WiFIEsp
  client.connect(serverESP2, 80);   // Connection to the server
  Serial.println(&quot;.&quot;);
  client.println(&quot;Hello server! Are you sleeping?\r&quot;);  // sends the message to the server
  String answerESP2 = client.readStringUntil(&#039;\r&#039;);   // receives the answer from the sever
  Serial.println(&quot;from server: &quot; + answerESP2);
  client.flush();

//--------------------------------------------------------------


}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[raitisgr]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=575</uri>
			</author>
			<updated>2018-03-11T13:50:55Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1385#p1385</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=154#p154" />
			<content type="html"><![CDATA[<p>Use Dlink or other router, no ESP</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-29T07:01:15Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=154#p154</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=135#p135" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>remotexy wrote:</cite><blockquote><p>Fast way is to use second router which connects to ESP1 or main router. Set the virtual server in the second router to connect to ESP1 to device port.</p></blockquote></div><p>Yes, that´s the way, but i don´t know how to set the virtual server of the second device to the ESP1</p>]]></content>
			<author>
				<name><![CDATA[Norman]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=52</uri>
			</author>
			<updated>2017-01-27T16:58:20Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=135#p135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=132#p132" />
			<content type="html"><![CDATA[<p>Fast way is to use second router which connects to ESP1 or main router. Set the virtual server in the second router to connect to ESP1 to device port.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-27T07:10:28Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=132#p132</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=131#p131" />
			<content type="html"><![CDATA[<p>I think easy way is impossible. ESP is not include the router feature. You have to make the special program for ESP</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-27T06:58:51Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=131#p131</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=123#p123" />
			<content type="html"><![CDATA[<p>Come on, no one with any ideas??</p>]]></content>
			<author>
				<name><![CDATA[Norman]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=52</uri>
			</author>
			<updated>2017-01-25T15:49:30Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=123#p123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Values from second ESP]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=118#p118" />
			<content type="html"><![CDATA[<p>Hey there....</p><p>I have two ESP8266, both are connectet to the router.<br />ESP1 is the webserver which RemoteXY is connected to.</p><p>Now, is it possible to get values from to ESP2 to the webinterface on ESP1? Maybe over IP??</p>]]></content>
			<author>
				<name><![CDATA[Norman]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=52</uri>
			</author>
			<updated>2017-01-23T11:28:23Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=118#p118</id>
		</entry>
</feed>
