summaryrefslogtreecommitdiff
path: root/weather_oneline.py
blob: 745d37d1bb0b6231b6d148259a738a236930e15e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import board
import busio
import digitalio
import adafruit_bme280
import datetime

i2c = busio.I2C(board.SCL, board.SDA)
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)

temp_c = bme280.temperature
temp_f = temp_c * 9 / 5 + 32
response = "%s,%0.1f,%0.1f,%0.1f" % (datetime.datetime.now(), temp_f, bme280.humidity, bme280.pressure)
print(response)