I have 3 freezer monitors working on the cloud, with the idea that I can see the temp in my freezers when I am away from home.
I have a puzzle with one monitor though. On the desktop I display the value and also have a chart to show saved data. However on the chart for one device no live data will show up - but if I go to hourly or longer data it shows data. The value does update. The other two monitors behave as expected showing live data as well as saved data. I am quite puzzled. Where do I start looking
the sketch is below, it works as expected with 2 monitors but not this one. When I click the live button on the chart it says no data available, but data does show if I click the hourly or daily buttons. It indicates the device is on line and the value object on the desktop does seem to update.
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/4ca0ba70-8858-4a67-94c4-73672db6f5e8
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int pAtemp1;
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 <OneWire.h>
#include <DallasTemperature.h>
unsigned long previousMillis = 0;
const long interval = 1000; //milliseconds
// Data wire is connected to the Arduino digital pin 4
#define ONE_WIRE_BUS 4
// Setup a OneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
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);
// Start up the library
sensors.begin();
// 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
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
//code here will update every 1 second
sensors.requestTemperatures();
PAtemp1 = sensors.getTempFByIndex(0);
Serial.println(PAtemp1);
}
}