Continuing the discussion from Arduino could dashboard not shown temperature data:
I have a problem identical to this.
I have the ESP32 module on line on the cloud.
I created the three variables (Temperature, Pressure and humidity in my case) in the
"ThingProperties.h" tab,
I have code in the "// Your code here" that reads the three variables and then writes them to the Cloud variables.
I Serial.print the three cloud variables to the monitor and they are accurately displayed on the monitor.
I have deleted and re-created all three variables ,
first in the thingProperties.h
and then successfully compiled, then used the variables in the "Thing Code" however they steadfastly stick to zero on all three, even thou they correctly display on the serial monitor.
YEs, the thing and the device are both on line .
Does anybody have any ideas on this?
Cheers
TomG
thingProperties.h
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char DEVICE_LOGIN_NAME[] = "518ab34a-65ae-4e23-ad96-ff46bdf60955";
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)
const char DEVICE_KEY[] = SECRET_DEVICE_KEY; // Secret device password
float cloud_H3;
float cloud_P3;
float cloud_T3;
void initProperties(){
ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
ArduinoCloud.addProperty(cloud_H3, READ, 10 * SECONDS, NULL);
ArduinoCloud.addProperty(cloud_P3, READ, 10 * SECONDS, NULL);
ArduinoCloud.addProperty(cloud_T3, READ, 10 * SECONDS, NULL);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);
_________________________
The thing Code (first tab) is as follows
#include "thingProperties.h"
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
Adafruit_BME280 bme; // I2C
unsigned long delayTime;
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(4);
ArduinoCloud.printDebugInfo();
unsigned status;
status = bme.begin();
delayTime = 5000;
}
void loop() {
ArduinoCloud.update();
// Your code here
delay(delayTime);
float Cloud_T3 = bme.readTemperature();
float Cloud_P3 = bme.readPressure();
float Cloud_H3 = bme.readHumidity();
/*Serial.print(25);
Serial.print("\t");*/
Serial.print(Cloud_T3);
Serial.print("\t");
Serial.print(Cloud_P3);
Serial.print("\t");
Serial.print(Cloud_H3);
Serial.println("\t");
}