2021-07-30 11:37:28 +01:00
|
|
|
"""BME688 / BME680 demo
|
|
|
|
|
|
|
|
This demo will work for both the BME680 and BME688.
|
|
|
|
"""
|
|
|
|
import time
|
2021-08-02 09:21:22 +01:00
|
|
|
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
|
2021-07-30 11:37:28 +01:00
|
|
|
from pimoroni_i2c import PimoroniI2C
|
|
|
|
|
|
|
|
PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
|
|
|
|
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}
|
|
|
|
|
2022-03-22 08:33:49 +00:00
|
|
|
i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)
|
2022-08-02 16:17:08 +01:00
|
|
|
|
2021-08-02 09:21:22 +01:00
|
|
|
bmp = BreakoutBME68X(i2c)
|
2022-08-02 16:17:08 +01:00
|
|
|
# If this gives an error, try the alternative address
|
|
|
|
# bmp = BreakoutBME68X(i2c, 0x77)
|
2021-07-30 11:37:28 +01:00
|
|
|
|
|
|
|
while True:
|
2021-08-02 09:21:22 +01:00
|
|
|
temperature, pressure, humidity, gas, status, _, _ = bmp.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))
|
2021-07-30 11:37:28 +01:00
|
|
|
time.sleep(1.0)
|