Current Lua downloadable firmware will be posted here

User avatar
By zeroday
#3059
gerardwr wrote:
zeroday wrote:Add a examples folder to git.
and the new repo address:
https://github.com/nodemcu/nodemcu-firmware

sorry for the inconvenience.


Hello zeroday.

Wow, you're active!! I really admire your firmware development, the API documentation and the VERY quick response to questions and answers.

I believe you have given the use of the ESP a considerable boost for (us) people that do not want to depend on numerous C recompiles. Excellent!

Adding an examples section is a good idea. Have you given any thought on how examples from the community could be made available. Severy examples are "hidden" in this now rapidly growing topic, and are getting lost. Any ideas?


@dnhkng have a really good idea.
I have pm admin to see if we can have a subsection.
User avatar
By zeroday
#3060
scargill wrote:Question - in experimenting we often need to update functions... and you get a complaint if you do that. You can delete a file - but can you delete a function without having to reboot every time?


I think this will do:
Code: Select allfunction ffff()
   print("ffff")
end
ffff()
-- do not need it
ffff = nil
-- or just redefine it
function ffff()
  print("second")
end
User avatar
By zeroday
#3061
scargill wrote:Another query - when running the likes of the little web server - still working a treat!! It shows the heap size - around 9k. I assume that's RAM. Where are functions held... in RAM or FLASH and if the latter - any rough idea of how much is available? i.e. as we get ambitious are we going to run out of room?


Code: Select allprint(node.heap())

shows the remain ram.

flash available(no file written): 0x55~0x7b sector.
that's about 150k byte

flash for holding xxx.lua file is enough for now.
but every lua file, when it runs, needs ram, which we have at most 21k. very little.
User avatar
By Erni
#3062 First a thank to zeroday for this lua implementation

I have the webserver running without problems.
I am planning to put some sensor reading ,and I found this easy way
to interface with an Arduino, or actually a ATtiny85.

The t85 simply serially prints the value of t, which update the value on the webpage:
Maybe others will find it useful, or there is a better way to do this


Code: Select allif(t==nil) then
t=12
end
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
    conn:on("receive",function(conn,payload) print(payload)
    conn:send("HTTP/1.1 200 OK\n\n")
    conn:send("<html><body>")
    conn:send("<h1>Erni's ESP8266</h1><BR>")
    conn:send("TEMP : " .. t .. "<BR>")
    conn:send("NODE.HEAP : " .. node.heap() .. "<BR>")
    conn:send("TMR.NOW : " .. tmr.now() .. "<BR>")
    conn:send("</html></body>")
    conn:on("sent",function(conn) conn:close() end)
  end)
end)