mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-07 20:40:46 +00:00
.
This commit is contained in:
34
ESP32-S2_Micro-BME280/main.py
Normal file
34
ESP32-S2_Micro-BME280/main.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from machine import Pin, I2C
|
||||
import machine
|
||||
import time
|
||||
import bosch_bme280
|
||||
|
||||
|
||||
## MAIN LOOP SECTION
|
||||
|
||||
led = Pin(15, Pin.OUT)
|
||||
scl = machine.Pin(22)
|
||||
sda = Pin(21)
|
||||
|
||||
i2c = I2C(scl, sda, freq=10000)
|
||||
|
||||
while True:
|
||||
bme = bosch_bme280.BME280(i2c=i2c)
|
||||
temp = bme.temperature
|
||||
hum = bme.humidity
|
||||
pres = bme.pressure
|
||||
|
||||
print('Temperature: ', temp)
|
||||
print('Humidity: ', hum)
|
||||
print('Pressure: ', pres)
|
||||
|
||||
time.sleep(0.25)
|
||||
led.value(1)
|
||||
time.sleep(0.25)
|
||||
led.value(0)
|
||||
time.sleep(0.25)
|
||||
led.value(1)
|
||||
time.sleep(0.25)
|
||||
led.value(0)
|
||||
time.sleep(1)
|
||||
|
Reference in New Issue
Block a user