Hi guys
I have my sketch running fine in my Nano 33 via USB showing temperature readings in the Serial Monitor from an AM2320 I2C sensor connected to the board.
When I connect the board to the Arduino IoT Cloud from my WiFi connection (I power the board via USB connected to my computer) a NaN readings begins. I have these NaN readings in my Serial Monitor and in the IoT Cloud Dashboard. More specifically, I have one correct temperature reading (only the first one) follow by NaN readings. You can see an example of the output in the Serial in the jpg attached.
Follow code:
/*
Sketch generated by the Arduino IoT Cloud Thing "SensorT"
https://create.arduino.cc/cloud/things/3341e254-fe2f-456b-9c6c-b0bcdc23ca2e
Arduino IoT Cloud Properties description
The following variables are automatically generated and updated when changes are made to the Thing properties
float temperature;
Properties 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 "arduino_secrets.h"
#include "thingProperties.h"
#include "Adafruit_Sensor.h"
#include "Adafruit_AM2320.h"
Adafruit_AM2320 am2320 = Adafruit_AM2320();
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();
am2320.begin();
}
void loop() {
ArduinoCloud.update();
// Your code here
temperature = am2320.readTemperature();
Serial.print(temperature);
Serial.println();
delay(3000);
}
Anyone with similar issue?
Thank you in advance.