As the title says... Chat on...

User avatar
By RogerClark
#5393 Im probably missing something

But to run the lua script, does it need to be uploaded every time the module is reset?

Or is it saved and rerun after a reboot

I.e can lua be used for a standalone esp8266 or only one with a Microcontroller attached to upload the script?
User avatar
By Warthog
#5395 When the LUA firmware is installed, after reboot it looks if init.lua is present. Then LUA is executing this file, please include in init.lua other files with "dofile".

This is my file init.lua:
Code: Select allprint('load LoaLoader')
dofile("LuaLoader.lua")

print('load WifiConnect')
dofile('WifiConnect.lua')

tmr.alarm(1,2000, 1, function()
   if wifi.sta.getip()==nil then
      print(" Wait for IP --> "..wifi.sta.status())
   else
      print("New IP address is "..wifi.sta.getip())
      tmr.stop(1)
      print('load DS18B20')
      dofile('DS18B20.lua')
   end
end)

print('init.lua ready')