LPS28 Library¶
lps28
¶
LPS28 pressure sensor drive for CircuitPython
Author(s): Jose D. Montoya
-
class lps28.LPS28(i2c_bus: busio.I2C, address: int =
0x5D
)[source]¶ Driver for the LPS28 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
LPS28
class. First you will need to import the libraries to use the sensorimport board import lps28
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA lps28 = LPS28.lps28(i2c)
Now you have access to the attributes
press = lps28.pressure
- property data_rate : str¶
Sensor data_rate
Mode
Value
lps28.ONE_SHOT
0b0000
lps28.RATE_1_HZ
0b0001
lps28.RATE_4_HZ
0b0010
lps28.RATE_10_HZ
0b0011
lps28.RATE_25_HZ
0b0100
lps28.RATE_50_HZ
0b0101
lps28.RATE_75_HZ
0b0110
lps28.RATE_100_HZ
0b0111
lps28.RATE_200_HZ
0b1000
- property full_scale : None¶
Sensor full_scale (0: mode 1, full scale up to 1260 hPa; 1: mode 2, full scale up to 4060 hPa)
Mode
Value
lps28.FULL_SCALE
0b1
lps28.NORMAL
0b0
- property high_threshold_enabled : bool¶
Set to
True
orFalse
to enable or disable the high pressure threshold
- property high_threshold_exceeded : bool¶
Returns
True
if the pressure high threshold has been exceeded. Must be enabled by settinghigh_threshold_enabled
toTrue
and setting apressure_threshold
.
- property low_threshold_enabled : bool¶
Set to
True
orFalse
to enable or disable the low pressure threshold.
- property low_threshold_exceeded : bool¶
Returns
True
if the pressure low threshold has been exceeded. Must be enabled by settinghigh_threshold_enabled
toTrue
and setting apressure_threshold
.
- property pressure_threshold : float¶
The high pressure threshold. Use
high_threshold_enabled
orhigh_threshold_enabled
to use it