File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
examples/SimpleTemperature Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ void loop()
3232{
3333 if (IMU.temperatureAvailable ())
3434 {
35- int temperature_deg = 0 ;
35+ float temperature_deg = 0 ;
3636 IMU.readTemperature (temperature_deg);
3737
3838 Serial.print (" LSM6DSOX Temperature = " );
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ int LSM6DSOXClass::gyroscopeAvailable()
174174 return 0 ;
175175}
176176
177- int LSM6DSOXClass::readTemperature (int & temperature_deg)
177+ int LSM6DSOXClass::readTemperature (float & temperature_deg)
178178{
179179 /* Read the raw temperature from the sensor. */
180180 int16_t temperature_raw = 0 ;
@@ -187,7 +187,7 @@ int LSM6DSOXClass::readTemperature(int & temperature_deg)
187187 static int const TEMPERATURE_LSB_per_DEG = 256 ;
188188 static int const TEMPERATURE_OFFSET_DEG = 25 ;
189189
190- temperature_deg = (static_cast <int >(temperature_raw) / TEMPERATURE_LSB_per_DEG) + TEMPERATURE_OFFSET_DEG;
190+ temperature_deg = (static_cast <float >(temperature_raw) / TEMPERATURE_LSB_per_DEG) + TEMPERATURE_OFFSET_DEG;
191191
192192 return 1 ;
193193}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class LSM6DSOXClass {
4242 int gyroscopeAvailable (); // Check for available data from gyroscope
4343
4444 // Temperature
45- int readTemperature (int & temperature_deg);
45+ int readTemperature (float & temperature_deg);
4646 int temperatureAvailable ();
4747
4848 private:
You can’t perform that action at this time.
0 commit comments