wifi.setmode(wifi.STATIONAP) wifi.ap.config({ssid="----",pwd="----"}) Relay1 = 3 gpio.mode(Relay1,gpio.OUTPUT) srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(client,request) local buf = ""; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); 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 buf = buf.."Auto Charging

Web Server

"; buf = buf.."

SWITCH 

"; buf = buf..""; local _on,_off = "","" if(_GET.pin == "oncharging")then gpio.write(Relay1, gpio.HIGH); elseif(_GET.pin == "offcharging")then gpio.write(Relay1, gpio.LOW); end client:send(buf); client:close(); collectgarbage(); end) end)