DHT11读取温湿度 失败

Parker
帖子创建于2020年02月25日 基础使用 1801 次浏览

from mpython import *

from dht import DHT11

dht=DHT11(Pin(Pin.P0))

while True:

dht.measure()

oled.fill(0)

oled.DispChar("温度:",0,10)

oled.text("%d" % (dht.temperature()), 48, 14)

oled.DispChar("湿度:",0,35)

oled.text("%d" % (dht.humidity()), 48, 40)

oled.show()

sleep_ms(100)

以上为官方文档示例:https://mpython.readthedocs.io/zh/master/classic/dht11.html,刷入后启动报错,错误信息如下:

Traceback (most recent call last):

File "main.py", line 7, in <module>

File "dht.py", line 16, in measure

OSError: [Errno 110] ETIMEDOUT

使用固件版本为:2020-01-16

1 条评论

Parker

2020年02月25日

具体报错的代码为:dht.measure()

有 1 条回复