Some little steps to reach my target. So i'm testing, at home, my mega pro embebbed the debug and after i'll move everything to the UNO whom is installed in my garage.
1) setted the new baud rate:
AT
OK
AT+CIOBAUD=19200
ERROR
AT+UART_DEF=19200,8,1,0,3
OK
2) loaded the sample code:
// RemoteXY debug
#define REMOTEXY__DEBUGLOG
#define REMOTEXY__DEBUGLOG_SERIAL Serial
#define REMOTEXY__DEBUGLOG_SPEED 115200
//#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#define REMOTEXY_MODE__ESP8266_SOFTSERIAL_POINT
#include <SoftwareSerial.h>
#include <RemoteXY.h>
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 19200
// RemoteXY connection settings
/*#define REMOTEXY_SERIAL Serial1
#define REMOTEXY_SERIAL_SPEED 115200*/
#define REMOTEXY_WIFI_SSID "relay_led"
#define REMOTEXY_WIFI_PASSWORD ""
#define REMOTEXY_SERVER_PORT 6377
uint32_t lastStatus=0;
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,1,0,1,0,26,0,10,202,0,
2,1,16,22,33,18,1,177,3,94,
79,110,0,79,70,70,0,65,34,70,
23,16,16 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t switch_1; // =1 if switch ON and =0 if OFF
// output variables
uint8_t led_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_SWITCH_1 10
void setup()
{
Serial.begin(115200);
//Serial1.begin(115200);
RemoteXY_Init ();
pinMode (PIN_SWITCH_1, OUTPUT);
digitalWrite(PIN_SWITCH_1, LOW);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay()
if(RemoteXY.switch_1==HIGH)
{
RemoteXY.led_g=255;
}
else {RemoteXY.led_g=0;}
//Serial1.print(Serial.readString());
while (millis() - lastStatus <= 500) // aspetta 0,5 secondi per terminare ma chiama il gestore RemoteXY
{RemoteXY_Handler ();}
}
and this is the output:
[ 0.000] Debug log started
[ 0.000] Init software serial 19200 baud
[ 0.001] pin RX=2; pin TX=3
[ 0.003] RemoteXY started
[ 1.005] -> AT
[ 2.008] -> AT
[ 3.011] -> AT
[ 4.014] -> AT
[ 5.017] -> AT
[ 6.020] -> AT
[ 7.023] -> AT
[ 8.026] -> AT
[ 9.029] -> AT
[ 10.031] Мodule does not respond to AT commands
[ 10.032] -> AT
[ 11.036] -> AT
[ 12.039] -> AT
[ 13.042] -> AT
[ 14.045] -> AT
[ 15.048] -> AT
[ 16.051] -> AT
[ 17.054] -> AT
[ 18.057] -> AT
[ 19.060] -> AT
[ 20.062] Мodule does not respond to AT commands
[ 20.063] -> AT
[ 21.067] -> AT
[ 22.070] -> AT
[ 23.073] -> AT
[ 24.076] -> AT
[ 25.079] -> AT
[ 26.082] -> AT
Now the problem is, i can connect to the AP but the app fails with the damn econnrefused. Connections between mega and esp8266 seem correct:
D2->GPIO1(TX)
D3->GPIO3(RX)
and the others to 2x3.3V and 1xground.
Nothing is notified during the connection to the AP and while the app tries to connect. I could test using the 2th serial hw port of my mega, but not with the UNO.