Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/SimpleTemperature/SimpleTemperature.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void loop()
{
if (IMU.temperatureAvailable())
{
int temperature_deg = 0;
float temperature_deg = 0;
IMU.readTemperature(temperature_deg);

Serial.print("LSM6DSOX Temperature = ");
Expand Down
4 changes: 2 additions & 2 deletions src/LSM6DSOX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int LSM6DSOXClass::gyroscopeAvailable()
return 0;
}

int LSM6DSOXClass::readTemperature(int & temperature_deg)
int LSM6DSOXClass::readTemperature(float& temperature_deg)
{
/* Read the raw temperature from the sensor. */
int16_t temperature_raw = 0;
Expand All @@ -187,7 +187,7 @@ int LSM6DSOXClass::readTemperature(int & temperature_deg)
static int const TEMPERATURE_LSB_per_DEG = 256;
static int const TEMPERATURE_OFFSET_DEG = 25;

temperature_deg = (static_cast<int>(temperature_raw) / TEMPERATURE_LSB_per_DEG) + TEMPERATURE_OFFSET_DEG;
temperature_deg = (static_cast<float>(temperature_raw) / TEMPERATURE_LSB_per_DEG) + TEMPERATURE_OFFSET_DEG;

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LSM6DSOX.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LSM6DSOXClass {
int gyroscopeAvailable(); // Check for available data from gyroscope

// Temperature
int readTemperature(int & temperature_deg);
int readTemperature(float& temperature_deg);
int temperatureAvailable();

private:
Expand Down