Simple test

Ensure your device works with this simple test.

examples/bmp3xx_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import adafruit_bmp3xx
 7
 8# I2C setup
 9i2c = board.I2C()  # uses board.SCL and board.SDA
10bmp = adafruit_bmp3xx.BMP3XX_I2C(i2c)
11
12# SPI setup
13# from digitalio import DigitalInOut, Direction
14# spi = board.SPI()
15# cs = DigitalInOut(board.D5)
16# bmp = adafruit_bmp3xx.BMP3XX_SPI(spi, cs)
17
18bmp.pressure_oversampling = 8
19bmp.temperature_oversampling = 2
20
21while True:
22    print(
23        "Pressure: {:6.4f}  Temperature: {:5.2f}".format(bmp.pressure, bmp.temperature)
24    )
25    time.sleep(1)