If you’ve been following the blog you’ll know we are THAT far off getting a working web server out of the ESP8266 and the LUA firmware – which has to beat the pants off messing with a compiler.
The code below setup a webserver – which will look for “?myarg=” – get the value and send it back…and increment a counter. If that request is not there – it does nothing..
03:13PM – Problem is – hit refresh on the browser several times and…. it crashes…. it has to be the interpreter or it would not work several times! Still some way to go.
if string.find(payload,”?myarg=”) then
m=”<br/>Value= ” .. string.sub(payload,string.find(payload,”?myarg=”)+7,string.find(payload,”HTTP”)-2)
conn:send(“<h1> Hello, this is Pete’s web page.</h1>How are you today.<br/> Count=” .. mycounter .. m .. “Heap=”.. node.heap())
conn:on(“sent”,function(conn) conn:close() end)
If you try the above example – assuming you are connected to your router… point a browser to it (note normal port 80) you will see the heap (RAM starts at maybe 5800bytes and takes a drop each time you refresh… and just keeps going down and down and.. at around 3k it bombs… if you get half way down and stop for 5 mins, the heap will recover – but clearly this is useless for polling – I have reported this with the code and I am just hoping this can be fixed..
4304 (wait 30 secs)
4304 (wait 3 minues)
5856 (- note not as high as it was originally
4688 (wait 5 minutes)
and at 3100 – the next refresh – the board resets…
This is getting SO NEAR yet maddeningly so far. I cannot imagine why on earth the stack would take so long to clear.
Oh – and the A./D convertor on the ESP-01 is pin 6 ! I had the soldering iron out a while ago and… nope.. wrong wire, soldering iron too thick… magnifier naff.