Skip to content

Commit 9c46ae4

Browse files
authored
Correct temperature reading method signatures (#39)
The documentation for `readTemperature()` didn't match the implementation and was missing for `readTemperatureFloat()`.
1 parent da62e33 commit 9c46ae4

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

docs/api.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,16 +346,16 @@ Reads the temperature from the sensor (Celsius).
346346
#### Syntax
347347

348348
```
349-
IMU.readTemperature()
349+
IMU.readTemperature(temperature_deg)
350350
```
351351

352352
#### Parameters
353353

354-
None.
354+
* _temperature_deg_: int variable where the temperature value will be stored.
355355

356356
#### Returns
357357

358-
The temperature in Celsius.
358+
None.
359359

360360
#### Example
361361

@@ -371,6 +371,38 @@ if (IMU.temperatureAvailable())
371371
}
372372
```
373373

374+
### `readTemperatureFloat()`
375+
376+
Reads the temperature from the sensor (Celsius).
377+
378+
#### Syntax
379+
380+
```
381+
IMU.readTemperatureFloat(temperature_deg)
382+
```
383+
384+
#### Parameters
385+
386+
* _temperature_deg_: float variable where the temperature value will be stored.
387+
388+
#### Returns
389+
390+
None.
391+
392+
#### Example
393+
394+
```
395+
if (IMU.temperatureAvailable())
396+
{
397+
float temperature_deg = 0.0f;
398+
IMU.readTemperatureFloat(temperature_deg);
399+
400+
Serial.print("LSM6DSOX Temperature = ");
401+
Serial.print(temperature_deg);
402+
Serial.println(" °C");
403+
}
404+
```
405+
374406
### `temperatureAvailable()`
375407

376408
Checks if temperature data is available.
@@ -401,4 +433,4 @@ if (IMU.temperatureAvailable())
401433
Serial.print(temperature_deg);
402434
Serial.println(" °C");
403435
}
404-
```
436+
```

0 commit comments

Comments
 (0)