首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >节点未定义常量uart.PARITY_NONE

节点未定义常量uart.PARITY_NONE
EN

Stack Overflow用户
提问于 2021-03-22 13:31:42
回答 1查看 13关注 0票数 0

我遇到了与这个问题相同的问题,只是定义了uart.STOPBITS_1,而没有定义parity_NONE:

nodemcu uart undefined constants?

代码语言:javascript
复制
>
uart=require("uart")
>
=uart
table: 0x4028d530
>
=print(uart.parity_NONE)
nil
>
=uart.STOPBITS_1
1
> 

当前固件

代码语言:javascript
复制
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
    branch: release
    commit: 136e09739b835d6dcdf04034141d70ab755468c6
    release: 3.0.0-release_20210201
    release DTS: 202102010145
    SSL: true
    build type: float
    LFS: 0x0 bytes total capacity
    modules: adc,bit,file,gpio,net,node,tmr,uart,wifi,tls
 build 2021-03-17 08:20 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)

测试代码:

代码语言:javascript
复制
    uart=require("uart")
    print(uart.STOPBITS_1)
    print(uart.parity_NONE)
    uart.setup(0, 19200, 8, uart.parity_NONE, uart.STOPBITS_1, 0)

错误: stdin:1:'setup‘的参数#4不正确(需要编号,但得到的值为空)

EN

回答 1

Stack Overflow用户

发布于 2021-03-22 16:27:33

问题解决了,奇偶校验区分大小写,所以应该是:

uart.PARITY_NONE

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66740772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档