Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4import time
5import board
6import adafruit_lps2x
7
8i2c = board.I2C() # uses board.SCL and board.SDA
9# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
10# uncomment and comment out the line after to use with the LPS22
11# lps = adafruit_lps2x.LPS22(i2c)
12lps = adafruit_lps2x.LPS25(i2c)
13
14while True:
15 print("Pressure: %.2f hPa" % lps.pressure)
16 print("Temperature: %.2f C" % lps.temperature)
17 time.sleep(1)