won't start after one restart
Posted: Tue Sep 29, 2015 12:49 am
hi guy
i flashed the last firmware with ESP8266Flasher
and after that uploaded this lua code via luauploader and ESPlorer
its work like charm
but unfortunately after reconnect USB arduino (i used arduino instead USB to TTL board ) two GPIO 0,2 get high and ip address won't work
please help me engineers
i flashed the last firmware with ESP8266Flasher
and after that uploaded this lua code via luauploader and ESPlorer
Code: Select all
--wifi.sta.setip({ip="192.168.1.10",netmask="255.255.252.0",gateway="192.168.1.1"})
wifi.setmode(wifi.SOFTAP);
--wifi.sta.config("SSID","pass")
wifi.ap.config({ssid="test",pwd="12345678"});
gpio2_state=1;
gpio0_state=1;
gpio.mode(3, gpio.OUTPUT,gpio.PULLUP)
gpio.mode(4, gpio.OUTPUT,gpio.PULLUP)
responseHeader = function(code, type)
return "HTTP/1.1 " .. code .. "\r\nConnection: close\r\nServer: nunu-Luaweb\r\nContent-Type: " .. type .. "\r\n\r\n";
end
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
client:send(responseHeader("200 OK","text/html"));
local buf2 = "";
local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
-- print(request);
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
end
local _GET = {}
if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end
local _on,_off = "","";
if(_GET.OFF == "1")then
gpio.write(3, gpio.LOW);
elseif(_GET.ON == "1")then
gpio.write(3, gpio.HIGH);
elseif(_GET.OFF == "2")then
gpio.write(4, gpio.LOW);
elseif(_GET.ON == "2")then
gpio.write(4, gpio.HIGH);
end
buf2 = "<html><body>";
buf2 = buf2.."<p>GPIO 1<a href=\"?ON=1\"><button>ON</button></a> <a href=\"?OFF=1\"><button>OFF</button></a></p>";
buf2 = buf2.."<p>GPIO 2<a href=\"?ON=2\"><button>ON</button></a> <a href=\"?OFF=2\"><button>OFF</button></a></p>";
buf2 = buf2.."</center></body></html>";
client:send(buf2);
client:close();
collectgarbage();
end)
end)
its work like charm
but unfortunately after reconnect USB arduino (i used arduino instead USB to TTL board ) two GPIO 0,2 get high and ip address won't work
please help me engineers