Post your best Lua script examples here

User avatar
By xtal
#42045 NODE MCU sdk 1.5.1

using
uart.on("data", "\n",uartRX,0)
sv=net.createServer(net.TCP, 30)
sv:listen(80,function(c)
c:on("sent", Send80)
c:on("receive", Rcv80)

uartRX
Rcv and parse data and load vars data < 256 works fine > 256 drops data

Rec80
parse data - do button stuff - tx to pic if needed [ then expect rcv data]
Send80(c) - send 1st part of web page

Send80 -- Use REQUIRE to load desired part of webpage
send the desired part of webpage
on next CB afterlast part sent
issue c:close()

THE problem is
I now drop data when serial input is > 256 char.
Before implementing the REQUIRE there was no serial issue at 38400 baud
after implementing REQUIRE after receiving 256 char the serial looses data for a while
then finishes , slowing baud to 9600 helps, does not fix..

NodeMCU does not support changing serial buffer size !
I only need a 32 byte Tx buffer and a 768 Rx buffer to receive max data...

Any suggestions on receiving the serial data would be appreciated....
I started using REQUIRE to reclaim some RAM