0

I'm experiencing the same problem as posted in this question, except that uart.STOPBITS_1 is defined and parity_NONE is not:

nodemcu uart undefined constants?

>
uart=require("uart")
>
=uart
table: 0x4028d530
>
=print(uart.parity_NONE)
nil
>
=uart.STOPBITS_1
1
> 

Current firmware

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)

Test code:

    uart=require("uart")
    print(uart.STOPBITS_1)
    print(uart.parity_NONE)
    uart.setup(0, 19200, 8, uart.parity_NONE, uart.STOPBITS_1, 0)

Error: stdin:1: bad argument #4 to 'setup' (number expected, got nil)

Biyau
  • 121
  • 1
  • 12

1 Answers1

1

Problem solved, parity is case sensitive, so it should be:

uart.PARITY_NONE

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
Biyau
  • 121
  • 1
  • 12