aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/micropython-i2c.py
blob: 47897c00813748be8af3181bc218cd25e349bdef (plain)
1
2
3
4
5
6
7
8
9
10
11
import bme280
import time

with bme280.BME280(i2cBus=0) as bme:
    while True:
        t, h, p = bme.readForced(filter=bme280.FILTER_4,
                                 tempOversampling=bme280.OVSMPL_4,
                                 humidityOversampling=bme280.OVSMPL_16,
                                 pressureOversampling=bme280.OVSMPL_4)
        print("t=%.2f  h=%.2f  p=%.1f" % (t, h * 1e2, p * 1e-2))
        time.sleep_ms(1000)
bues.ch cgit interface