2021-07-30 10:37:28 +00:00
|
|
|
"""BME688 / BME680 demo
|
|
|
|
|
|
|
|
This demo will work for both the BME680 and BME688.
|
|
|
|
"""
|
2025-04-15 10:14:16 +00:00
|
|
|
|
|
|
|
import machine
|
2021-07-30 10:37:28 +00:00
|
|
|
import time
|
2021-08-02 08:21:22 +00:00
|
|
|
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
|
2022-08-02 15:17:08 +00:00
|
|
|
|
2025-04-15 10:14:16 +00:00
|
|
|
bme = BreakoutBME68X(machine.I2C(), 0x76)
|
2022-08-02 15:17:08 +00:00
|
|
|
# If this gives an error, try the alternative address
|
2025-04-15 10:14:16 +00:00
|
|
|
# bme = BreakoutBME68X(machine.I2C(), 0x77)
|
2021-07-30 10:37:28 +00:00
|
|
|
|
|
|
|
while True:
|
2023-01-10 14:29:02 +00:00
|
|
|
temperature, pressure, humidity, gas, status, _, _ = bme.read()
|
2021-08-02 08:21:22 +00:00
|
|
|
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 10:37:28 +00:00
|
|
|
time.sleep(1.0)
|