Current Lua downloadable firmware will be posted here

User avatar
By zeroday
#2886
OpenThings wrote:A completed wifi xconsole for nodemcu on ESP8266:
Code: Select allprint("====Wicon, a LUA console over wifi.==========")
print("Author: openthings@163.com. copyright&GPL V2.")
print("Last modified 2014-11-19. V0.2")
print("Wicon Server starting ......")

function startServer()
   print("Wifi AP connected. Wicon IP:")
   print(wifi.sta.getip())
   sv=net.createServer(net.TCP)
   sv:listen(8080,   function(conn)
      print("Wifi 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
      end)
      conn:on("disconnection",function(conn)
         node.output(nil)
      end)
   end)   
   print("Wicon Server running at :8080")
   print("===Now,Using xcon_tcp logon and input LUA.====")
end

tmr.alarm(1000, 1, function()
   if wifi.sta.getip()=="0.0.0.0" then
      print("Connect AP, Waiting...")
   else
      startServer()
      tmr.stop()
   end
end)


8-)
Great job.
User avatar
By scargill
#2893 I'm struggling here.

I made sure I understood the startup file - by first simply announcing my name... great - works. And I understand that one needs to delete the file and start again to update it - that's fine.

I also know how to set the thing into WIFI mode... and os I wrote this startup file - sadly it shows 0.0.0.0 BEFORE and 0,0,0,0 AFTER. I can think of no way to use this stand-alone - if you can't set up the wifi on powerup ???

file.remove("init.lua")
file.open("init.lua","w")
file.writeline([[print("Petes Tester 3")]])
file.writeline([[print(wifi.sta.getip()) ]])
file.writeline([[wifi.setmode(wifi.STATION)]])
file.writeline([[wifi.sta.config("loft-east","xxxxxxxx")]])
file.writeline([[print(wifi.sta.getip()) ]])
file.close()
User avatar
By Hans174
#2895 Hello,

Is it possible to read and write to the SRAM and port adresses with the current LUA version?
Or is the memory module mentioned in the LUA manual 5.1 necessary?

Background is that I would like to access the ADC (analogue digital converter) of ESP8266 CPU.

Hans