I am attempting to connect my Arduino Nano 33 IoT to Arduino IoT Cloud. I am using this tutorial as a guideline: An intro to the Arduino IoT Cloud | Arduino Documentation
The code I am using takes temperature and humidity data from a DHT11 sensor and attempts to upload this data into Arduino IoT Cloud. However, whenever I run this code, I receive the following error message:
"ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to mqtts-sa.iot.arduino.cc:8883
ArduinoIoTCloudTCP::handle_ConnectMqttBroker 1 connection attempt at tick time 24904"
My wifi firmware is updated to the latest version, and I have ensured that my wifi connection is working and stable. I have also deleted the project and tried to start over, but still encounter the same issue. Are there any modifications I should make to my code, or naming conventions that may fix my problem?
Code for the sketch is here:
#include "thingProperties.h"
#include <EduIntro.h>
DHT11 dht11(4); // creating the object sensor on pin 'D7'
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
dht11.update();
temperature = dht11.readCelsius();
humidity = dht11.readHumidity();
delay(2000);
Serial.print(F("Humidity:"));
Serial.print(humidity);
Serial.print(F("Temperature:"));
Serial.print(temperature);
}