Simple test

Ensure your device works with this simple test.

examples/lps2x_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import time
import board
import busio
import adafruit_lps2x

i2c = busio.I2C(board.SCL, board.SDA)
# uncomment and comment out the line after to use with the LPS22
# lps = adafruit_lps2x.LPS22(i2c)
lps = adafruit_lps2x.LPS25(i2c)
while True:
    print("Pressure: %.2f hPa" % lps.pressure)
    print("Temperature: %.2f C" % lps.temperature)
    time.sleep(1)