pimoroni-pico-rp2350/examples/pico_plus_2/breakouts/bme68x-breakout.py
Phil Howard c9f5a28cd4 CI: Refactor to match our other tooling.
Retarget pimoroni-pico to feature/picovector2-and-layers.
2025-03-05 12:31:54 +00:00

21 lines
720 B
Python

import time
from pimoroni_i2c import PimoroniI2C
from breakout_bme68x import BreakoutBME68X
# SDA and SCL pins for the Pico Plus 2 QW/ST connector
PINS_PICO_PLUS_2 = {"sda": 4, "scl": 5}
# Setup an instance of I2C and BME68X
i2c = PimoroniI2C(**PINS_PICO_PLUS_2)
bme = BreakoutBME68X(i2c)
while True:
# Grab the readings
temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read()
# Print the current temperature, pressure and humidity. You'll be able to see this in Thonny's shell
print("Temperature: {}°C\nPressure:{} Pa\nHumidity:{} %rH\n\n".format(temperature, pressure, humidity))
# Now we take a little nap before the next reading ZzzzZz
time.sleep(1)