Current Lua downloadable firmware will be posted here

User avatar
By zeroday
#3046
scargill wrote:So I did some more tests this morning.

Examples from here: https://github.com/nodemcu/nodemcu-firmware

The TELNET example does not work and results in the module resetting every time..

The Web page example looks exciting at first.. but I noticed the browser returned the result "Hello NodeMCU but was constantly busy... and as browsers do, it retries the page.. and after 5 retries, the ESP-01 resets. Here's the output I monitored on the serial.

So here is the power up sequence and my init file getting an address from the router - all of that works..

Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
> c_GORSvfJSz.JSzfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.192.168.0.22
OK


and then here is where I add in the web page example


> srv=net.createServer(net.TCP)
> srv:listen(80,function(conn)
>> conn:on("receive",function(conn,payload)
>> print(payload)
>> conn:send("<h1> Hello, NodeMcu.</h1>")
>> end)
>> end)
>


and then here is the result...

> GET / HTTP/1.1
Host: 192.168.0.22
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; Android 5.0; Nexus 10 Build/LRX21P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


but then wait... the browser of course gets the page again... and again. and....

GET / HTTP/1.1
Host: 192.168.0.22
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; Android 5.0; Nexus 10 Build/LRX21P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


PANIC: unprotected error in call to Lua API (attempt to call a nil value)
c_GORSvf
SzfJSzfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.192.168.0.22
OK

So a quick test suggests it works - but in fact after a few refreshes - the unprotected error occurs and the board resets.


I got the same error, after 10+ refreshes.
sorry, some examples need more tests, before it's writen in the doc.
the code below disconnect with client when payload is sent. may be it's better, still little tests made.

Code: Select allsrv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
   print(payload) print(node.heap())
   conn:send("<h1> Hello, NodeMcu.</h1>")
   end)
conn:on("sent",function(conn) conn:close() end)
end)
User avatar
By gerardwr
#3048
scargill wrote:The Web page example looks exciting at first.. but I noticed the browser returned the result "Hello NodeMCU but was constantly busy... and as browsers do, it retries the page.. and after 5 retries, the ESP-01 resets. Here's the output I monitored on the serial.


The example does not work "as is", it provides no correct response for (my) browser. The browser needs a proper HTML response from the ESP web server, returning a simple "Hello" does not suffice for the browser to recognize the response.

Many pages back in this topic I posted an extended and working example web server that can be succesfully addressed by a browser. That worked then, and still works in the latest firmware.

Have at look at my previous post, and see if this will run for you.
http://www.esp8266.com/viewtopic.php?f=6&t=534&start=70#p2801
User avatar
By gerardwr
#3049
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?
User avatar
By dnhkng
#3052 Seeing as this topic has more replies than the next 3 pages of topics on the General Discussion board, maybe the Mods could create a new subsection? Maybe a NodeMcu board under Projects or Platforms?

That would lets us discuss separate bugs/features/requests in separate threads. People could also post example code in new threads, making them easier to find.

-David