MODULE 1 CODE:-
/* RemoteXY select connection mode and include library */
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h>
/* RemoteXY connection settings */
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "Project"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377
/* RemoteXY configurate */
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,2,0,29,0,123,0,8,33,1,
130,1,1,0,61,36,82,130,1,1,
38,61,30,82,129,0,9,1,46,6,
8,84,69,77,80,69,82,65,84,85,
82,69,0,67,5,4,9,55,13,16,
201,8,67,5,4,24,55,9,16,201,
21,129,0,19,40,25,6,8,72,69,
65,84,69,82,0,2,1,6,48,50,
16,1,26,31,31,79,78,0,79,70,
70,0,130,1,1,70,61,29,82,129,
0,19,72,26,6,8,67,79,79,76,
69,82,0,2,1,7,80,49,16,135,
26,31,31,79,78,0,79,70,70,0 };
/* this structure defines all the variables of your control interface */
struct {
/*input variable*/
uint8_t switch_1; // =1 if switch ON and =0 if OFF
uint8_t switch_2; // =1 if switch ON and =0 if OFF
/* output variable */
char text_1[30]; /* string end zero UNICODE */
char text_2[22];
/* other variable */
uint8_t connect_flag; /* =1 if wire connected, else =0 */
} RemoteXY;
#pragma pack(pop)
#define PIN_SWITCH_1 13
#define PIN_SWITCH_2 12
void setup()
{
RemoteXY_Init ();
pinMode (PIN_SWITCH_1, OUTPUT);
pinMode (PIN_SWITCH_2, OUTPUT);
}
void loop()
{
RemoteXY_Handler ();
/* get the ADC value */
int sensorValue = analogRead(A0);
double mv = (sensorValue/1024.0)*5000;
double temp = mv/10;
dtostrf(temp, 0, 2, RemoteXY.text_1);
if(temp>=25.00)
{
sprintf(RemoteXY.text_2,"HEATER");
}
else
{
sprintf(RemoteXY.text_2,"COOLER");
}
/*convert the temperature value into a string
and place it immediately in the field text_1 patterns RemoteXY
*/
Serial.print("TEMPERATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(1200);
digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);
digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2==0)?LOW:HIGH);
}