NodeMcu - A lua based firmware for esp8266

zeroday
Posts: 1
Joined: Thu Nov 13, 2014 11:22 am

NodeMcu - A lua based firmware for esp8266

Postby zeroday » Fri Nov 14, 2014 8:30 pm

Hi, all
Glad to release a firmware that is powered by lua.
https://github.com/nodemcu/nodemcu-firmware

This firmware act like a lua interpreter inside esp8266,
you can type lua chunk from serial port, and do what ever you like.
here are some examples:

Config wifi

Code: Select all

    print(wifi.sta.getip())
    --0.0.0.0
    wifi.setmode(wifi.STATION)
    wifi.sta.config("SSID","password")
    print(wifi.sta.getip())
    --192.168.18.110


Manipulate hardware like a arduino

Code: Select all

    pin = 1
    gpio.mode(pin,gpio.OUTPUT)
    gpio.write(pin,gpio.HIGH)
    print(gpio.read(pin))


Write network application in nodejs style

Code: Select all

    -- A simple http client
    conn=net.createConnection(net.TCP, false)
    conn:on("receive", function(conn, payload) print(c) end )
    conn:connect(80,"115.239.210.27")
    conn:send("GET / HTTP/1.1\r\nHost: www.baidu.com\r\n"
        .."Connection: keep-alive\r\nAccept: */*\r\n\r\n")


Or a simple http server

Code: Select all

   
    -- A simple http server
    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)


Play with LED

Code: Select all

  function led(r,g,b)
    pwm.setduty(0,r)
    pwm.setduty(1,g)
    pwm.setduty(2,b)
  end
  pwm.setup(0,500,50)
  pwm.setup(1,500,50)
  pwm.setup(2,500,50)
  pwm.start(0)
  pwm.start(1)
  pwm.start(2)
  led(50,0,0) -- red
  led(0,0,50) -- blue


If you want to run something when system started

Code: Select all

  --init.lua will be excuted
  file.open("init.lua","w")
  file.writeline([[print("Hello, do this at the beginning.")]])
  file.close()
  node.restart()  -- this will restart the module.

Hope you guys like it.
Last edited by zeroday on Thu Nov 20, 2014 11:43 pm, edited 1 time in total.

costaud
Posts: 138
Joined: Fri Oct 24, 2014 7:40 pm

Re: NodeMcu - A lua based firmware for esp8266

Postby costaud » Sat Nov 15, 2014 10:53 pm

Excellent!!
Looking forward to the source code!

Squonk
Posts: 6
Joined: Sat Oct 25, 2014 1:04 am

Re: NodeMcu - A lua based firmware for esp8266

Postby Squonk » Sun Nov 16, 2014 5:20 pm

costaud wrote:Excellent!!
Looking forward to the source code!

This won't happen "soon" :cry:

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: NodeMcu - A lua based firmware for esp8266

Postby rudi » Tue Nov 18, 2014 6:32 pm

Squonk wrote:
costaud wrote:Excellent!!
Looking forward to the source code!

This won't happen "soon" :cry:


why you think this not happen soon ?

btw

lua, which version * you take zeroday * ..
actual release is 5.2.3 ? , there are more developer version's
test1, test2, test3.. ., alpha, work, beta ;-) ...
http://www.lua.org/work/
http://www.lua.org/versions.html
http://www.lua.org/ftp/

because i work on 5.2.3
http://www.lua.org/ftp/lua-5.2.3.tar.gz
and esp8266 too .. ;-)

is this oK for the grit fw zeroday?

best wishes
rudi ;-)

edit: declare lua version *

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

alonewolfx2
Posts: 12
Joined: Sun Oct 26, 2014 6:14 am

Re: NodeMcu - A lua based firmware for esp8266

Postby alonewolfx2 » Wed Dec 31, 2014 8:00 pm

It's open-source now. Here is github link https://github.com/nodemcu/nodemcu-firmware

Who is online

Users browsing this forum: No registered users and 0 guests