完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我尝试使用带有 ESP8266 的 DHT11 传感器检索湿度和温度。但是,我遇到了编译错误,例如“lua:4: unexpected symbol near ','”。如果可能的话,任何人都可以指出这段代码中的其他潜在错误吗?我的代码如下所示:
代码:全选 pin = 1 status, temp, humi, temp_dec, humi_dec = dht.read(pin)--read dht11 from pin if status == dht.OK then --check status is ok and print temperature and humidity print(string.format( "DHT Temperature:%d.%03d;Humidity:%d.%03d" ) math.floor(temp), temp_dec, math.floor(humi), humi_dec ) elseif status == dht.ERROR_CHECKSUM then --else print either status print( "DHT Checksum error." ) elseif status == dht.ERROR_tiMEOUT then print( "DHT timed out." ) end |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
235个成员聚集在这个小组
加入小组573 浏览 1 评论
2773 浏览 2 评论
为blufi_device设置自定义名称,但是无法修改,为什么?
506浏览 4评论
请问ESP32-S2-WROOM怎么获得ESP32-S2外接FLASH的唯一序列号?
281浏览 3评论
1119浏览 3评论
ESP-Jumpstart例程中第5个工程:5_cloud连接报错是哪里的问题?
293浏览 2评论
用AT+CIPSNTPCFG=1,8,\"cn.ntp.org.cn\",\"ntp.sjtu.edu.cn\"更新不了时间怎么处理?
797浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-5-22 17:51 , Processed in 1.150260 second(s), Total 74, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191