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();
}

2 (edited by Paavo 2021-01-11 09:02:00)

Re: Multiple instances of RemoteXY

Compiling error:
When I compile the whole scetch:
error: no matching function for call to 'CRemoteXY::CRemoteXY(const uint8_t [16], <anonymous struct>*, char*&, char*&, const uint16_t&)'

When I compile first part, removing all Data for RemoteXY's instance 2 and/or rxy2 -lines, result is same error.

What could be a reason?

3

Re: Multiple instances of RemoteXY

i have download the source code but unable to solve

4

Re: Multiple instances of RemoteXY

I think I'm in a somewhat similar situation.  I am using ESP-32 Dev boards to control relays that operate large door openers remotely.  I did this with BLE and experienced moderate success but the range was limited. Today I tried using the ESP-32s in the Wi-fi Access Mode.  This works fine when I used it with Shop Door A only.  I disconnected that board and tried my other board.  I discarded the setup for Door A and "added" door opener B.  This worked fine also by itself.

I then tried having them both within the App but was not successful.  I believe the problem is that RemoteXY uses the network name RemoteXY for each by default.  It appears that I need to change the network name in one or the other and maybe both to  new network names so that the mobile app will connect with the proper board.  The buildings are fairly close together and both would likely be in range at the same time.  Would I do this within the sketch or elsewhere?

5

Re: Multiple instances of RemoteXY

tedbear wrote:

Would I do this within the sketch or elsewhere?

You can set WiFi access point name in editor or change the define in sketch

#define REMOTEXY_WIFI_SSID "RemoteXY"