from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(27))
while True:
try:
sleep(1)
sensor.measure()
print("温度:", sensor.temperature())
except OSError as e:
print("error")
from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(27))
while True:
try:
sleep(1)
sensor.measure()
print("温度:", sensor.temperature())
except OSError as e:
print("error")