void setup()
{
mqttClient.setId(deviceID);
mqttClient.setDeviceIdToken(deviceID, deviceToken);
Serial.println("Connecting to Qubitro...");
if (!mqttClient.connect(host, port))
{
Serial.println("Connection failed! Error code = ");
Serial.println(mqttClient.connectError());
Serial.println("Visit docs.qubitro.com or create a new issue on github.com/qubitro");
while (1);
}
Serial.println("Connected to the Qubitro !");
mqttClient.subscribe(deviceID);
mqttClient.onMessage(receivedMessage);
}
Subscribes to the topic (the device itself in this example)
Publishes data in a loop with a delay of 2 seconds.
Prints message and subscribed topic (the device itself in this example)
Example output:
Connecting to WiFi...
Connected to the WiFi
Connecting to Qubitro...
Connected to the Qubitro !
New message received:{"Temp":33}
New message received:{"Temp":33}
New message received:{"Temp":33}
Support and Feedback
If you have further questions or suggestions, feel free to join -> Qubitro Community Discord via this invitation link.