Hello, I am currently doing an activity using Arduino Uno Wifi Rev 2, and using DHT11.
Whenever I upload on Arduino Cloud, It says it is done uploading, and the values is reflected on the Serial Monitor. however I don't see any values in the dashboard, I noticed my device was offline even if the upload is working it is still offline. and I am also connected on my Internet i put the SSID and the password already still doesn't work.
Please take note I have three variables on my Thing which are
temperature - for the temperature values
humidity - for the humidity values
message - for the messenger value
Here is my sketch
#include "DHT.h"
#define DHT11_PIN 2
DHT dht11(DHT11_PIN, DHT11);
void setup() {
Serial.begin(9600);
dht11.begin(); // initialize the sensor
}
void loop() {
// wait a few seconds between measurements.
delay(2000);
// read humidity
float humidity = dht11.readHumidity();
// read temperature as Celsius
float temperatureC = dht11.readTemperature();
// read temperature as Fahrenheit
float temperatureF = dht11.readTemperature(true);
// check if any reads failed
if (isnan(humidity) || isnan(temperatureC) || isnan(temperatureF)) {
Serial.println("Failed to read from DHT11 sensor!");
} else {
// Construct message with humidity, temperature in Fahrenheit, and temperature in Celsius
String message = "Humidity = " + String(humidity) + "%, Temperature (Celsius) = " + String(temperatureC) + "°C, Temperature (Fahrenheit) = " + String(temperatureF) + "°F";
// Print the message
Serial.println(message);
}
}
/*
Since Message is a READ_WRITE variable, onMessageChange() is
executed every time a new value is received from IoT Cloud.
*/
void onMessageChange() {
// Add your code here to act upon Message change
}
/*
Since Humidity is a READ_WRITE variable, onHumidityChange() is
executed every time a new value is received from IoT Cloud.
*/
void onHumidityChange() {
// Add your code here to act upon Humidity change
float humidity = dht11.readHumidity();
}
/*
Since Temp is a READ_WRITE variable, onTempChange() is
executed every time a new value is received from IoT Cloud.
*/
void onTempChange() {
// Add your code here to act upon Temp change
float temperatureC = dht11.readTemperature();
}
/*
Since Text is a READ_WRITE variable, onTextChange() is
executed every time a new value is received from IoT Cloud.
*/
void onTextChange() {
// read humidity
float humidity = dht11.readHumidity();
// read temperature as Celsius
float temperatureC = dht11.readTemperature();
// read temperature as Fahrenheit
float temperatureF = dht11.readTemperature(true);
// Construct message with humidity, temperature in Fahrenheit, and temperature in Celsius
String message = "Humidity = " + String(humidity) + "%, Temperature (Celsius) = " + String(temperatureC) + "°C, Temperature (Fahrenheit) = " + String(temperatureF) + "°F";
// Print the message
Serial.println(message);
}
/*
Since Temperature is a READ_WRITE variable, onTemperatureChange() is
executed every time a new value is received from IoT Cloud.
*/
void onTemperatureChange() {
// Add your code here to act upon Temperature change
}
