第八次课内容回顾
开发板温湿度传感器连线

温湿度测量代码
import dht
import time,json
import machine
dht11=dht.DHT11(machine.Pin(5))
# 构建测量函数
def measure(dht11):
dht11.measure()
temp,hum=dht11.temperature(), dht11.humidity()
data = f"当前温度: {temp}℃ 湿度: {hum}RH"
print(data)
time.sleep(1)
return temp,hum
def main():
temp,hum=measure(dht11)
print(f"wd:{temp},sd:{hum}")
if __name__=="__main__":
main()
巴法云:https://cloud.bemfa.com/tcp/devicemqtt.html
创建巴法云账号,并登录
进入控制台切换为MQTT设备云

右边根据需要,创建自定义Topic
