Post your best Lua script examples here
User avatar
By gerardwr
#3261 I already published this message in the now closed "examples" topic to facilitate further discussion.

IOT example:
- sends ADC value to a webserver every 3 seconds (needs connection to TOUT pin of ESP, not tested myself)
- sends GPIO value to a webserver at every GPIO level change (interrupt at every UP or DOWN flank)
- provides a webpage with some ESP data

Schermafbeelding 2014-11-24 om 17.43.30.png


Schermafbeelding 2014-11-24 om 17.37.48.png


Upload the file below to init.lua on the ESP, and reboot the ESP.
(2.54 KiB) Downloaded 411 times


Latest updates:
(125.84 KiB) Downloaded 328 times
Last edited by gerardwr on Mon Dec 01, 2014 4:24 am, edited 6 times in total.
User avatar
By RichardS
#3270 Nice, thanks, in time we were going to try and pull out anything trapped! :o

Richard.
User avatar
By gerardwr
#3369 Hi,
My example was downloaded almost 50 times, but without any response from the downloaders :?

I'm not here for personal glory, but would appreciate suggestions, either positieve OR critical.

I have extended the webserver part of the example. It now displays all files present on the ESP in a clickable link. Clicking on a .HTML file displays this file in the browser. Clicking on a .LUA file will execute LUA statements in it (in development). I'm still pondering on embedding LUA statements in a HTML file, like CGI.

Anyone interested in followups or have some suggestions.