Left here for archival purposes.

User avatar
By hreintke
#5444 LS,
Running NodeMCU 20121222.

When using the function uart.on("data", function(data) .... end)
Using CR as line ending:
The parameter data contains :
- first receive -> all characters until CR
- next receives -> CR + characters received

Using CRLF ending
The parameter data contains :
- first receive -> all characters until CR
- next receives -> LF + characters received

And there is still the previous mentioned ">" response, also when run_unit parameter = 0.

I am using the following test program.
Code: Select alluart.setup( 0, 9600, 8, 0, 1, 0 )
    uart.on("data",
      function(data)
--        for i=1, string.len(data) do print (i) print(string.byte(data,i)) end
--        print("receive ",string.len(data)," chars from uart: ", data, " First = ", string.byte(data))
        if data=="quit" then
          uart.on("data")
          uart.setup( 0, 9600, 8, 0, 1, 1 )
        end       
    end, 0)