mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-07 18:26:52 +00:00
.
This commit is contained in:
@@ -284,3 +284,4 @@ class BME280:
|
|||||||
hd = h * 100 // 1024 - hi * 100
|
hd = h * 100 // 1024 - hi * 100
|
||||||
return "{}.{:02d}%".format(hi, hd)
|
return "{}.{:02d}%".format(hi, hd)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from machine import Pin, I2C
|
from machine import Pin, I2C
|
||||||
import machine
|
#import machine
|
||||||
import time
|
import time
|
||||||
import bosch_bme280
|
import bosch_bme280
|
||||||
|
|
||||||
@@ -7,10 +7,8 @@ import bosch_bme280
|
|||||||
## MAIN LOOP SECTION
|
## MAIN LOOP SECTION
|
||||||
|
|
||||||
led = Pin(15, Pin.OUT)
|
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:
|
while True:
|
||||||
bme = bosch_bme280.BME280(i2c=i2c)
|
bme = bosch_bme280.BME280(i2c=i2c)
|
||||||
@@ -18,6 +16,7 @@ while True:
|
|||||||
hum = bme.humidity
|
hum = bme.humidity
|
||||||
pres = bme.pressure
|
pres = bme.pressure
|
||||||
|
|
||||||
|
print('\n')
|
||||||
print('Temperature: ', temp)
|
print('Temperature: ', temp)
|
||||||
print('Humidity: ', hum)
|
print('Humidity: ', hum)
|
||||||
print('Pressure: ', pres)
|
print('Pressure: ', pres)
|
||||||
@@ -32,3 +31,4 @@ while True:
|
|||||||
led.value(0)
|
led.value(0)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user