Chat freely about anything...

User avatar
By wchpikus
#66582 hello
my setup:

uart.setup(0,115200,8,0,1,0)
print(wifi.sta.getip())
wifi.setmode(wifi.STATION)
wifi.sta.config("xxxxxx","xxxxx") -- ap w radiu
gpio.mode(1, gpio.OUTPUT) --red led
gpio.mode(2, gpio.OUTPUT) --green red
gpio.write(1, gpio.LOW) --led red off
gpio.write(2, gpio.LOW) --led green off


tmr.create():alarm(500, 1, function(cb_timer)
if wifi.sta.getip() == nil then
gpio.write(1, gpio.HIGH) --red led on
gpio.write(2, gpio.LOW) --green led off
else
cb_timer:unregister()
gpio.write(2, gpio.HIGH) --green led on
gpio.write(1, gpio.LOW)--red led off
print("Connected, IP is "..wifi.sta.getip())
cl=net.createConnection(net.TCP, 0)
cl:connect(23,"192.168.4.1")
end

--server tcpip---

srv = net.createConnection(net.TCP, 0)
-- srv:on("receive", function(sck, data) print(data) end)
srv:on("receive", function(sck, data) print(data) end)
srv:on("connection", function(sck)
end)



srv:connect(23,"192.168.4.1")
gpio.write(1, gpio.LOW)
dofile("keys.lua")


end)

and now i have AP on the second esp, connected uart to device..
Problem is:

When i connect via putty on server, i see all responses, i can send command and everything working (device->uart->server->putty).
On the client on another esp (code above), i can send command using
cl:send("text something\r\n"), and i see this on device and putty.
But response on esp (client) i have some problem...
I see the data, but..
e.g on putty i have - A2DP STREAMING START 0
on esp(client) - A2DP STREAMING S
TART 0
Brake after "S"
Another commands receive also was brake.
e.g
HFP 3 STATUS "signal" 2 - HFP 3 STATUS "si
gnal" 2

Brake..

I look on hex mode, and i sow 0D, 0A data inside on this strings...
why?

The second thing, this bug disable to me parse incoming string to made some action..

Could i ask for some help with this issue?
Some error on code or something?

Regards