mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2024-10-05 20:47:50 -04:00
.
This commit is contained in:
parent
a588a23c14
commit
8ba2b0cd1b
@ -284,3 +284,4 @@ class BME280:
|
||||
hd = h * 100 // 1024 - hi * 100
|
||||
return "{}.{:02d}%".format(hi, hd)
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user