设为首页收藏labplus社区产品资料库
0
积分值+2
0
掌控币+1
0  关注
0  粉丝
1  帖子
Parker
2020年02月25日

#基础使用#DHT11读取温湿度 失败

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

0

点赞

1424 次阅读1 条评论1 条回复
1条评论