Hello,
I'm trying to measure temperature in celsius with the examples for the LSM6DS3
https://app.arduino.cc/sketches/examples?nav=Libraries&eid=arduino_lsm6ds3_1_0_3%2Fexamples%2FSimpleTempSensor&slid=arduino_lsm6ds3_1_0_3
even though i used the original code from the examples, the data shown in the serial monitor are 3 digits which is slightly higher than my room temperature:
Temperature sensor sample rate = 52.00 Hz
Temperature reading in degrees C
T
***** Arduino IoT Cloud - configuration info *****
Device ID:
MQTT Broker: iot.arduino.cc:8883
WiFi.status(): 0
Current WiFi Firmware: 1.5.0
128.44
127.50
123.87
127.25
123.62
125.44
126.62
127.00
124.87
127.62
124.31
127.37
128.69
124.69
128.50
127.31
124.75
The used code looks like this:
#include <Arduino_LSM6DS3.h>
void setup() {
Serial.begin(9600);
while (!Serial);
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
Serial.print("Temperature sensor sample rate = ");
Serial.print(IMU.temperatureSampleRate());
Serial.println(" Hz");
Serial.println();
Serial.println("Temperature reading in degrees C");
Serial.println("T");
// 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
if (IMU.temperatureAvailable()) {
// after IMU.readTemperature() returns, t will contain the temperature reading
IMU.readTemperature(t);
Serial.println(t);
}
}
/*
Since T is READ_WRITE variable, onTChange() is
executed every time a new value is received from IoT Cloud.
*/
void onTChange() {
// Add your code here to act upon T change
}
Can anyone of tell me what i did wrong?
Best regards,
Thomas