LED On & OFF problem

Hi All,
my code looks like ok but when I try to turn on the Led on its going off, when I try to turn the Led off its going On what can I do many thanks for your help, using Lua and ESP12E

wifi.setmode(wifi.STATION)
wifi.sta.config(“SSID “,“Pass”)
print(wifi.sta.getip())
gpio.mode(3, gpio.OUTPUT)
srv=net.createServer(net.TCP, 1)
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…”

SHU Web Server

”;
buf = buf…“

GPIO0 <a href=”?pin=ON1">ON <a href="?pin=OFF1">OFF

";

local _on,_off = “”,""

if(_GET.pin == “ON1”)then
gpio.write(3, gpio.HIGH);
elseif(_GET.pin == “OFF1”)then
gpio.write(3, gpio.LOW);

end
client:send(buf);
client:close();
collectgarbage();
end)
end)

Are you sure you're on the right forum?

Groove:
Are you sure you're on the right forum?

Or planet. Or drugs.

maybe look here to help!

not much Lua happening on either forums...