You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
426 B
Python
24 lines
426 B
Python
5 months ago
|
import time
|
||
|
|
||
|
from dht import DHT11
|
||
|
from machine import Pin
|
||
|
|
||
|
|
||
|
sensor1 = DHT11(Pin(2))
|
||
|
# sensor2 = DHT11(Pin(2))
|
||
|
|
||
|
|
||
|
while True:
|
||
|
data = {
|
||
|
"sensor_1": {
|
||
|
"temp": sensor1.temperature(),
|
||
|
"humidity": sensor1.humidity(),
|
||
|
},
|
||
|
# "sensor_2": {
|
||
|
# "temp": sensor2.temperature(),
|
||
|
# "humidity": sensor2.humidity(),
|
||
|
# },
|
||
|
}
|
||
|
print(data)
|
||
|
time.sleep(3)
|