This is my example:
http://remotexy.com/en/editor/922181bfa … b3b215c09/
And the code:
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "your ssid"
#define REMOTEXY_WIFI_PASSWORD "your password"
#define REMOTEXY_SERVER_PORT 6377
uint8_t flag1;
uint8_t val01;
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,1,0,1,0,33,0,10,13,1,
1,1,22,22,17,17,29,133,0,65,
26,23,23,15,15,129,0,21,6,21,
6,6,82,101,108,101,32,48,49,0 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t button_1; // =1 if button pressed, else =0
// output variables
uint8_t led_1_g; // =0..255 LED Green brightness
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
// #define PIN_BUTTON_1 D2 // For NodeMCU V3
#define PIN_BUTTON_1 2 // For ESP8266-01
void setup()
{
RemoteXY_Init ();
pinMode (PIN_BUTTON_1, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
if (RemoteXY.button_1==0) flag1=0; // Detects the change of state of the button.
if ((RemoteXY.button_1==1) && flag1==0){
if (val01==1){
val01=0;
}
else{
val01=1;
}
flag1=1;
digitalWrite(PIN_BUTTON_1, val01);
}
RemoteXY.led_1_g = (digitalRead(2)==HIGH)?255:0;
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay()
}
What you don't know ... Question !! and what you know ... Share !! - By Joan