How to connect to two different Things (Devices) on Arduino IoT Cloud using one ESP8266 module

Hello,

I'm able to connect my ESP8266 module with Arduino IoT Cloud.
And it is working fine.

Here is my code...

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

CloudLight my_LED;

const char DEVICE_LOGIN_NAME[]    = "0f16dd88-377c-4e48-855a-e4836eaa2137";
const char DEVICE_KEY[]           = "DV#3bHvImGaiGZ?goOTcFNhi!";
const char SSID[]                 = "My_WiFi";
const char PASS[]                 = "12345678";

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

void setup() {
  pinMode(1, OUTPUT);
  ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
  ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
  ArduinoCloud.addProperty(my_LED, READWRITE, ON_CHANGE, onMyLEDChange);
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
}

void loop() {
  ArduinoCloud.update();
}

void onMyLEDChange()  {
  digitalWrite(1,my_LED);
}

Now, I want to connect to two different Things (Devices) of Arduino IoT Cloud with my ESP8266 module.

Is it possible to do this?

If yes, please share the example code.

Hi @brijesh_investing. You should only use an Arduino Cloud IoT Device in a single Thing at a time.

If you no longer need to use the Device in a given Thing, you are welcome to attach it to a different Thing, but it should only be one thing at a time.

If you need multiple Things at once, then you should get an additional board and create a new Thing for that new board.

You can use the Variables from multiple Things in the a single Arduino Cloud IoT dashboard if you want to use a single interface to interact with several Things.

Thanks @ptillisch for the quick reply.
My doubt is now clear.

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.