Hello,
I am very new to using Arduino and the Arduino IoT Cloud. I am trying to connect a MLX90614 temperature sensor to my Arduino Nano 33 IoT and view the readings on the Arduino IoT Cloud but am having issues.
Additional Info: My sensor works on the offline Arduino IDE application. SCL and SDA pins are connected to the SCL and SDA pins on the Nano 33 IoT. My firmware is updated to the latest version: 1.4.8
When I upload my code through the Arduino Web Editor, the Serial Monitor shows either one of the following:
The following is my code:
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/a71bddfd-f705-4db0-bbcb-0c2e675a1663
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudTemperatureSensor temperature;
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 <Adafruit_MLX90614.h>
#include "Wire.h"
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial);
mlx.begin();
// 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(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
temperature = mlx.readObjectTempC();
Serial.print("Temperature: ");
Serial.println(temperature);
delay(500);
}
Is there an issue with my code? Am I missing a step? Any guidance on what I can do will be greatly appreciated.
- Abigail