Current Lua downloadable firmware will be posted here

User avatar
By scargill
#3091 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)
User avatar
By cendev
#3092
alonewolfx2 wrote:i am trying to send telnet.lua example and i am getting this error. what am i suppose to do?

Code: Select allNodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
> function startServer()
>> print("AP connected IP:")
>> print(wifi.sta.getip())
>> sv=net.createServer(net.TCP)
>> sv:listen(8080, function(conn)
>> print("Console connected.")
>> function s_output(str)
>> if (conn~=nil) then
>> conn:send(str)
>> end
>> end
>> node.output(s_output,1)
>> conn:on("receive", function(conn, pl)
>> node.input(pl)
>> if (conn==nil) then
>> print("conn is nil.")
>> end
lua: not enough memory
PANIC: unprotected error in call to Lua API (not enough memory)


M.box full ? =)
User avatar
By alonewolfx2
#3093 soo ? =)

cendev wrote:
alonewolfx2 wrote:i am trying to send telnet.lua example and i am getting this error. what am i suppose to do?

Code: Select allNodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
> function startServer()
>> print("AP connected IP:")
>> print(wifi.sta.getip())
>> sv=net.createServer(net.TCP)
>> sv:listen(8080, function(conn)
>> print("Console connected.")
>> function s_output(str)
>> if (conn~=nil) then
>> conn:send(str)
>> end
>> end
>> node.output(s_output,1)
>> conn:on("receive", function(conn, pl)
>> node.input(pl)
>> if (conn==nil) then
>> print("conn is nil.")
>> end
lua: not enough memory
PANIC: unprotected error in call to Lua API (not enough memory)


M.box full ? =)
User avatar
By Hans174
#3097
Code: Select allled = 8
i = 0
gpio.mode(led, gpio.OUTPUT)
function blink()
   print(i)
   if i % 2 == 0 then
      gpio.write(led, gpio.HIGH)
   else
      gpio.write(led, gpio.LOW)
   end
   i=i+1
   if i == 10 then
      print("done")
      tmr.stop()
   end
end

tmr.alarm(1000, 1, blink) -- Let it blink


Hello,

There are only 21.5 KBytes of RAM and it is very difficult to write a longer program.
This tiny bit of LUA code consumes about 8 KBytes of RAM. Why?

Hans