from machine import Pin
import time,machine,dht



data = dht.DHT22(Pin(15))  # 实例化15号管脚

while True:
    data.measure()     # 先调用测量函数,获取温湿度
    temp=data.temperature()
    humi=data.humidity()
    print(temp, humi)
    time.sleep(1)
Loading
esp32-devkit-c-v4