17 lines
392 B
Python
17 lines
392 B
Python
from machine import Pin, I2C
|
|
import uBME280
|
|
import time
|
|
|
|
i2c = I2C(0, scl = Pin(9), sda = Pin(8), freq = 400000)
|
|
|
|
BME_addr = 0x76;
|
|
|
|
bme280 = uBME280.BME280(uBME280.BME280_OSAMPLE_1, BME_addr, i2c)
|
|
|
|
while True:
|
|
t = str(bme280.read_temperature()/100)
|
|
p = str(bme280.read_pressure()/1000)
|
|
h = str(bme280.read_humidity()/1000)
|
|
time.sleep(1)
|
|
|
|
print(t, p, h) |