Post your best Lua script examples here

User avatar
By alexhi
#8288
M0ebius wrote:@alexhi:
I've tried your script and the udp send ("srv:send(data)") does not work here (NodeMCU 0.9.5 build 20150124)

To send a udp message a had to do:
Code: Select allc=net.createConnection(net.UDP, 0)
c:connect(8008,"192.168.4.255")
uart.on("data",0,function(data)c:send(data)end, 0)

Did i do something wrong, or is srv:send not working anymore?



I have not tested it build 20150124 , but I think it should work. You are testing the network 192.168.4.XXX ?
User avatar
By Edgar dos Reis
#43347 Hi!
I'm doing a similar work, I'm trying make a bridge between MQTT and UART in ESP8266.
But there is a problem that I can't solve, there isn't a command to receive data from UART (something like uart.recv() or something).

Do you know if there is some command to do it? Because my ESP need receive data from my MSP430 by UART.

Since now, Thanks for help me and sorry for my English.

Edgar dos Reis