4 from bme280
import BME280
7 from smbus2
import SMBus
9 from smbus
import SMBus
14 format
='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
16 datefmt
='%Y-%m-%d %H:%M:%S')
18 logging
.info("""weather.py - Print readings from the BME280 weather sensor.
25 bme280
= BME280(i2c_dev
=bus
)
28 temperature
= bme280
.get_temperature()
29 pressure
= bme280
.get_pressure()
30 humidity
= bme280
.get_humidity()
31 logging
.info("""Temperature: {:05.2f} *C
32 Pressure: {:05.2f} hPa
33 Relative humidity: {:05.2f} %
34 """.format(temperature
, pressure
, humidity
))