pimoroni-pico/micropython/examples/breakout_bme690/demo_bme690.py

20 wiersze
596 B
Python

"""BME69X demo
Demo of how to read the BME690 sensor.
"""
import machine
import time
from breakout_bme69x import BreakoutBME69X, STATUS_HEATER_STABLE
bme = BreakoutBME69X(machine.I2C(), 0x76)
# If this gives an error, try the alternative address
# bme = BreakoutBME69X(machine.I2C(), 0x77)
while True:
temperature, pressure, humidity, gas, status, _, _ = bme.read()
heater = "Stable" if status & STATUS_HEATER_STABLE else "Unstable"
print("{:0.2f}c, {:0.2f}Pa, {:0.2f}%, {:0.2f} Ohms, Heater: {}".format(
temperature, pressure, humidity, gas, heater))
time.sleep(1.0)