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
点赞