Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2015-08-03 | Konrad Beckmann | Konrad Beckmann | bmp085.c |
This module provides access to the BMP085 temperature and pressure sensor. The module also works with BMP180.
Initializes the module.
bmp085.setup()
None
nil
Samples the sensor and returns the temperature in celsius as an integer multiplied with 10.
bmp085.temperature()
temperature multiplied with 10 (integer)
local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW)
bmp085.setup()
local t = bmp085.temperature()
print(string.format("Temperature: %s.%s degrees C", t / 10, t % 10))
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.
bmp085.pressure(oversampling_setting)
oversampling_setting
integer that can be 0, 1, 2 or 3
pressure in pascals (integer)
local sda, scl = 1, 2
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
bmp085.setup()
local p = bmp085.pressure()
print(string.format("Pressure: %s.%s mbar", p / 100, p % 100))
Samples the sensor and returns the raw pressure in internal units. Might be useful if you need higher precision.
bmp085.pressure_raw(oversampling_setting)
oversampling_setting
integer that can be 0, 1, 2 or 3
raw pressure sampling value (integer)