As the title says... Chat on...

User avatar
By sigrokBlack
#17365 Hi,
how can I recode this example, just with the difference, that this esp isn't the server. It should connect to a server.
Code: Select alluart.setup(0,9600,8,0,1,0)
sv=net.createServer(net.TCP, 60)
global_c = nil
sv:listen(9999, function(c)
   if global_c~=nil then
      global_c:close()
   end
   global_c=c
   c:on("receive",function(sck,pl)   uart.write(0,pl) end)
end)

uart.on("data",4, function(data)
   if global_c~=nil then
      global_c:send(data)
   end
end, 0)

https://github.com/nodemcu/nodemcu-firm ... p2uart.lua

Greetings from Germany
Joshua
User avatar
By TerryE
#17558 Joshua, there are plenty of examples here on this forum and in the lua files included in the distribution which should get you started. You should really try to make a first stb yourself, rther that saying "I don't know how to do this. Can someone do my thinking and research for me?" :twisted: