1

Topic: RemoteXY_Init () with more than one WiFi SSID/password

At the moment to set the Wifi network you want to connect to they are set in:-

#define REMOTEXY_WIFI_SSID "ssid"
#define REMOTEXY_WIFI_PASSWORD "password"

Then this connects to the wifi:-

  RemoteXY_Init ();

Is there any way to give RemoteXY different SSIDs and passwords so we can change wifi network, eg:-

RemoteXY_Init ( "SSID2", "PASSWORD2" );

2

Re: RemoteXY_Init () with more than one WiFi SSID/password

Yes. You can see this in the library examples.

3 (edited by Scrotus 2024-04-02 10:52:18)

Re: RemoteXY_Init () with more than one WiFi SSID/password

Thank you.  For anyone else who finds this thread in the future, this is the code I used (this is for the ESP32 Wifi Cloud).  WFName and WFPW are char arrays that can then set to whatever credentials needed in the code.

#define WF_MAX_LEN 64 
char WFName[ WF_MAX_LEN ] = REMOTEXY_WIFI_SSID ; // string UTF8 end zero
char WFPW[ WF_MAX_LEN ] = REMOTEXY_WIFI_PASSWORD ; // string UTF8 end zero

//Use this instead of RemoteXY_Init ();

remotexy = new CRemoteXY (
      RemoteXY_CONF_PROGMEM, 
      &RemoteXY, 
      new CRemoteXYConnectionCloud (
        new CRemoteXYComm_WiFi (
        WFName,       // REMOTEXY_WIFI_SSID
        WFPW ),          // REMOTEXY_WIFI_PASSWORD
        "cloud.remotexy.com",   // REMOTEXY_CLOUD_SERVER
        6376,                   // REMOTEXY_CLOUD_PORT
        REMOTEXY_CLOUD_TOKEN  // REMOTEXY_CLOUD_TOKEN
      )
    );

4

Re: RemoteXY_Init () with more than one WiFi SSID/password

Hi Scrotus; can you post the full code, with the several SSIDs (SSID2, SSID2... etc? ? i could not do it.

5 (edited by Scrotus 2024-04-29 06:30:54)

Re: RemoteXY_Init () with more than one WiFi SSID/password

You just need to copy whatever SSID and password you want to use into the WFName and WFPassword char arrays, using for example strcpy, then the code I posted above .  Eg:-

strcpy( WFName, "MyWifi");
strcpy( WFPassword, "123456789");

remotexy = new CRemoteXY (
      RemoteXY_CONF_PROGMEM, 
      &RemoteXY, 
      new CRemoteXYConnectionCloud (
        new CRemoteXYComm_WiFi (
        WFName,       // REMOTEXY_WIFI_SSID
        WFPW ),          // REMOTEXY_WIFI_PASSWORD
        "cloud.remotexy.com",   // REMOTEXY_CLOUD_SERVER
        6376,                   // REMOTEXY_CLOUD_PORT
        REMOTEXY_CLOUD_TOKEN  // REMOTEXY_CLOUD_TOKEN
      )
    );