This commit is contained in:
Alexander 2024-07-12 14:26:13 -04:00
parent a588a23c14
commit 8ba2b0cd1b
2 changed files with 5 additions and 4 deletions

View File

@ -284,3 +284,4 @@ class BME280:
hd = h * 100 // 1024 - hi * 100
return "{}.{:02d}%".format(hi, hd)

View File

@ -1,5 +1,5 @@
from machine import Pin, I2C
import machine
#import machine
import time
import bosch_bme280
@ -7,10 +7,8 @@ import bosch_bme280
## MAIN LOOP SECTION
led = Pin(15, Pin.OUT)
scl = machine.Pin(22)
sda = Pin(21)
i2c = I2C(scl, sda, freq=10000)
i2c = I2C(1, scl=Pin(9), sda=Pin(8), freq=10000)
while True:
bme = bosch_bme280.BME280(i2c=i2c)
@ -18,6 +16,7 @@ while True:
hum = bme.humidity
pres = bme.pressure
print('\n')
print('Temperature: ', temp)
print('Humidity: ', hum)
print('Pressure: ', pres)
@ -32,3 +31,4 @@ while True:
led.value(0)
time.sleep(1)