1

Topic: Multiple instances of RemoteXY

Here is an example code (for NodeMCU v3 or other ESP8266 dev boards) showing that it is possible to have two or more instances of RemoteXY in the same program smile

- Change "mySSID" and "myPassword" in the code for the values of your WiFi AP, and upload to your ESP8266 devboard.
- Connect your Smartphone to that WiFi AP.
- Open RemoteXY App, click "+" and add two Ethernet devices with hostname "rxy" and port 8266 and 8267.

char * ssid     = "mySSID";
char * password = "myPassword";
char * hostName = "rxy";

#include <ESP8266WiFi.h>

#define REMOTEXY_MODE__ESP8266WIFI_LIB
#include <RemoteXY.h> 



// Data for RemoteXY's instance 1
CRemoteXY *rxy1;

const uint16_t rxy1_port = 8266;

const uint8_t PROGMEM rxy1_config[] = { 0,0,12,0,6,5,1,129,0,2,2,4,6,9,65,0 };

struct {
  uint8_t connect_flag;  /* =1 if wire connected, else =0 */
} rxy1_struct;



// Data for RemoteXY's instance 2
CRemoteXY *rxy2;

const uint16_t rxy2_port = 8267;

const uint8_t PROGMEM rxy2_config[] = { 0,0,12,0,6,5,1,129,0,2,2,4,6,9,66,0 };
  
struct {
  uint8_t connect_flag;  /* =1 if wire connected, else =0 */
} rxy2_struct;



void setup()
{
  WiFi.hostname( hostName );
  
  rxy1 = new CRemoteXY( rxy1_config, &rxy1_struct, ssid, password, rxy1_port );
  rxy2 = new CRemoteXY( rxy2_config, &rxy2_struct, ssid, password, rxy2_port );
} 

void loop() 
{
  rxy1->handler();
  rxy2->handler();
}