Arduino IOT cloud

Are people familiar with IoT Cloud from Arduino? I am busy reading the temperature and humidity. I follow a program from YouTube. It works for the person on YouTube, but I don't see any values. I have no error codes in my program and this is the same as in the example, can anyone help me?

Start by posting your sketch here, using code tags when you do

Presumably you have set up a "Thing" for then sensor. Have you set up a dashboard so that you can see the values and can you see the values in the Serial monitor of the Web Editor ?

/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/279b9874-78bb-43f2-af0d-aca6cd9618d7

Arduino IoT Cloud Variables description

The following variables are automatically generated and updated when changes are made to the Thing

CloudTemperatureSensor temperature;
CloudRelativeHumidity humidity;

Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN,DHTTYPE);

int pin = 2;
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);
dht.begin();
pinMode(2,OUTPUT);

// 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();
DHT_SENSOR_READ();

}

void DHT_SENSOR_READ()
{
float h = dht.readHumidity();
Serial.print("Humidity");
Serial.println(h);
float t = dht.readTemperature();
Serial.print("Temperature");
Serial.println(t);
temperature = t;
humidity = h;
delay(1000);
}

This is my sketch, I am working with a dashboard, where I have linked a gauge meter to the temperature and a percentage to the humidity

Did you miss the request to use code tags when posting your sketch ? It really does make reading and copying it for examination so much easier

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Hi @jelletil

1. As @UKHeliBob has requested

2. Please share your Thing setup

3. Have you configured the Things WiFi settings correctly?

4. Change the setDebugMessageLevel(2); to Level 4 & monitor the debug output within the Serial monitor, then at least you will be able to see that the device is correctly connecting to IOT cloud.

5. My Cloud Variables for Temperature and humidity are set as -

  float humidity;
  float temperature;

6. If it's working correctly, you should be able to monitor the uploaded values within the Thing as shown below -

HTH?

My humidity is extremly high now.

I have also noticed that sometimes the Arduino goes offline for no reason

The arduino is online, but it doesn't get values

Your code uses blocking code. (delay())
That will push your arduino offline......
Try learning about non blocking code....

Check this article: https://docs.arduino.cc/arduino-cloud/cloud-interface/sketches#alternatives-to-delays

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