Arduino Cloud can't see values in dashbord

with the Arduino Cloud Editor I created a code for DHT 22 with Arduoino MKR 1010. With the monitor te code works perfectly, but in the dashboard I can't see the values. Hope someone can help me. Thank you in advance.

Here the main code:

/*
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
  https://create.arduino.cc/cloud/things/25ca4c71-bb9b-4965-b868-7a66833ff20b

  Arduino IoT Cloud Variables description

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

  int hum;
  int temp;

  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"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define DHTPIN 7
#define DHTTYPE DHT22
#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels
#define OLED_RESET 4      // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
DHT dht(DHTPIN, DHTTYPE);



String message;  //to store messages written in Serial Monitor
int text_size;   //changes text size of the display




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);

   
  dht.begin();
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {  // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // loop forever if library fails to initialize
  }


  display.setTextColor(SSD1306_WHITE);  //set text to white
  setDebugMessageLevel(DBG_NONE);//original (2)
  ArduinoCloud.printDebugInfo();
}

void loop() {
  
 ArduinoCloud.update();
 
    temp = dht.readTemperature();
    hum = dht.readHumidity();
    Serial.print("Temperatur: ");
    Serial.print(temp);
    Serial.println(" C");
    Serial.print("Feuchtigkeit:");
    Serial.print(hum);
    Serial.println("%");
    display.clearDisplay();
    display.setTextSize(1);
    display.setCursor(0, 0);  //start printing at top left corner
    display.print("Temperatur:   ");
    display.print(temp);  //prints the content of the message string on the display
    display.print("C");     //transfers the buffer to the display
    display.setTextSize(1);
    display.setCursor(0, 18);
    display.print("Feuchtigkeit: ");
    display.print(hum);
    display.print("%");
    display.display();
 
}

Here the thingProperties.h code:

// Code generated by Arduino IoT Cloud, DO NOT EDIT.

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

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_OPTIONAL_PASS;    // Network password (use for WPA, or use as key for WEP)


int hum;
int temp;

void initProperties(){

  ArduinoCloud.addProperty(hum, READ, 60 * SECONDS, NULL);
  ArduinoCloud.addProperty(temp, READ, 60 * SECONDS, NULL);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

Hi,
can you try to raise the debug level with setDebugMessageLevel(4); and check if the connection with the cloud is successful. You should see a message showing the ThingID of your thing.

Connected to Arduino IoT Cloud
Thing ID: 25ca4c71-bb9b-4965-b868-7a66833ff20b

On the other hand, if you see something like

Connection to "<YOUR_WIFI>" failed

that would mean that there's something going wrong with your local WiFi.

Let me know how it goes.

Thank you for your answer. I tried again and it works now with the same code as before. Contact with WiFi was ok, maybe it was a bug of Arduino-Cloud.

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