Re: NodeMcu - A LUA based firmware for ESP8266 (build 20141
Posted: Fri Nov 21, 2014 10:10 am
Here is the revised code with the heap display coming up on the remote browser... the recovery makes this unusable - typical application might be for a mobile phone to poll the status of something - would not last a minute..... I hope you can fix because this is SO NEAR to being useful.
mycounter=0
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
if string.find(payload,"?myarg=") then
mycounter=mycounter+1
m="<br/>Value= " .. string.sub(payload,string.find(payload,"?myarg=")+7,string.find(payload,"HTTP")-2)
else
m=""
end
conn:send("<h1> Hello, this is Pete's web page.</h1>How are you today.<br/> Count=" .. mycounter .. m .. "Heap=".. node.heap())
end)
conn:on("sent",function(conn) conn:close() end)
end)
mycounter=0
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
if string.find(payload,"?myarg=") then
mycounter=mycounter+1
m="<br/>Value= " .. string.sub(payload,string.find(payload,"?myarg=")+7,string.find(payload,"HTTP")-2)
else
m=""
end
conn:send("<h1> Hello, this is Pete's web page.</h1>How are you today.<br/> Count=" .. mycounter .. m .. "Heap=".. node.heap())
end)
conn:on("sent",function(conn) conn:close() end)
end)