-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #936 from kbeckmann/bmp085-docs
- Loading branch information
Showing
2 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# BMP085 Module | ||
|
||
This module provides access to the BMP085 temperature and pressure sensor. The module also works with BMP180. | ||
|
||
## bmp085.init() | ||
Initializes the module and sets the pin configuration. | ||
|
||
#### Syntax | ||
`bmp085.init(sda, scl)` | ||
|
||
#### Parameters | ||
- `sda` data pin | ||
- `scl` clock pin | ||
|
||
#### Returns | ||
`nil` | ||
|
||
## bmp085.temperature() | ||
Samples the sensor and returns the temperature in celsius as an integer multiplied with 10. | ||
|
||
#### Syntax | ||
`bmp085.temperature()` | ||
|
||
#### Returns | ||
`integer` temperature multiplied with 10. | ||
|
||
#### Example | ||
```lua | ||
bmp085.init(1, 2) | ||
local t = bmp085.temperature() | ||
print(string.format("Temperature: %s.%s degrees C", t / 10, t % 10)) | ||
``` | ||
|
||
## bmp085.pressure() | ||
Samples the sensor and returns the pressure in pascal as an integer. | ||
|
||
The optional `oversampling_setting` parameter determines for how long time the sensor samples data. | ||
The default is `3` which is the longest sampling setting. Possible values are 0, 1, 2, 3. | ||
See the data sheet for more information. | ||
|
||
#### Syntax | ||
`bmp085.pressure(oversampling_setting)` | ||
|
||
#### Parameters | ||
- `oversampling_setting` integer that can be 0, 1, 2 or 3. | ||
|
||
#### Returns | ||
`integer` pressure in pascals. | ||
|
||
#### Example | ||
```lua | ||
bmp085.init(1, 2) | ||
local p = bmp085.pressure() | ||
print(string.format("Pressure: %s.%s mbar", p / 100, p % 100)) | ||
``` | ||
|
||
## bmp085.pressure_raw() | ||
Samples the sensor and returns the raw pressure in internal units. Might be useful if you need higher precision. | ||
|
||
#### Syntax | ||
`bmp085.pressure_raw(oversampling_setting)` | ||
|
||
#### Parameters | ||
- `oversampling_setting` integer that can be 0, 1, 2 or 3. | ||
|
||
#### Returns | ||
`integer` raw pressure sampling value |