It works for me between 2 esp-07
-- a udp client asta transmite dar nu receptioneaza
wifi.sleeptype(wifi.MODEM_SLEEP)
wifi.setphymode(wifi.PHYMODE_N)
wifi.setmode(wifi.STATIONAP);
wifi.ap.config({ssid="CLIENT",pwd="xxxxxxxx"});
wifi.ap.setip({ip="172.10.10.1",nm="255.255.255.0",gw="172.10.10.1"});
wifi.sta.config("SERVER","xxxxxxxx");
wifi.sta.setip({ip="10.10.10.2",nm="255.255.255.0", gw="10.10.10.1"});
tmr.alarm(0, 500, 1, function()
if wifi.sta.status() ~= 5 then
print("IP unavaiable, Waiting...");
else
print("ESP8266 mode is: " .. wifi.getmode());
print("The module MAC address is: " .. wifi.ap.getmac());
print("SERVER AP IP is "..wifi.ap.getip());
print("SERVER STA IP is "..wifi.sta.getip());
print("SERVER STA CONNECTED");
tmr.stop(0);
end
end)
tmr.alarm(1, 5000, 1, function() node.restore() end)
function client()
uart.setup( 0,115200, 8, 0, 1, 1 )
srv=net.createServer(net.UDP,0)
srv:on("receive", function(srv, pl) tmr.wdclr() uart.write(0,pl) end)
srv:listen(1000) uart.on("data",0,function(data)srv:send(data)end, 0)
c=net.createConnection(net.UDP)
c:connect(1000,"10.10.10.1")
uart.on("data",0,function(data) c:send(data)end, 0)
end
client()
--udp server asta receptioneaza dar nu transmite
wifi.sleeptype(wifi.MODEM_SLEEP)
wifi.setphymode(wifi.PHYMODE_N)
wifi.setmode(wifi.STATIONAP);
wifi.ap.config({ssid="SERVER",pwd="xxxxxxxx"});
wifi.ap.setip({ip="10.10.10.1",nm="255.255.255.0",gw="10.10.10.1"});
wifi.sta.config("CLIENT","xxxxxxxx");
wifi.sta.setip({ip="172.10.10.2",nm="255.255.255.0", gw="172.10.10.1"});
tmr.alarm(0, 1000, 1, function()
if wifi.sta.status() ~= 5 then
print("IP unavaiable, Waiting...");
else
print("ESP8266 mode is: " .. wifi.getmode());
print("The module MAC address is: " .. wifi.ap.getmac());
print("SERVER AP IP is "..wifi.ap.getip());
print("SERVER STA IP is "..wifi.sta.getip());
print("SERVER STA CONNECTED");
tmr.stop(0);
end
end)
tmr.alarm(1, 5000, 1, function() node.restore() end)
function server()
uart.setup( 0,115200, 8, 0, 1, 1 )
srv=net.createServer(net.UDP,0)
srv:on("receive", function(srv, pl) tmr.wdclr() uart.write(0,pl) end)
srv:listen(1000) uart.on("data",0,function(data)srv:send(data)end, 0)
c=net.createConnection(net.UDP)
c:connect(1000,"172.10.10.1")
uart.on("data",0,function(data) c:send(data)end, 0)
end
server()
The firmware is one custom build nodemcu-dev-29-modules-2015-11-04-13-35-22-float