Category:NodeMCU

From ElectroDragon Wiki
(Redirected from ESP8266 NodeMCU Lua)

Upload Sketch

For nodemcu to upload sketch (old)

  • Use script interpreter LUA as embedded system programming
  • open Nodemcu flasher/esp download tool/esptool.py to upload this firmware, more details see here, see some guidelines here
  • Restart module and upload lua scripts: LEDBlink.lua, init.lua, mqtt2.lua


Quick Start Guide for Lua



Quick Start

Testing (LUA commands)

LUA command hello.jpg
  • Connect the board and run node.restart() commands to see the reboot info
NodeMCU 0.9.6 build 20150406  powered by Lua 5.1.4
lua: cannot open init.lua
  • Using any Serial tool, send interactive commands, should have following reply:
print("hello world")


Startup lua file init.lua

  • New flashed board has no any script inside
  • when module bootup successfully, it will run lua code file init.lua in default
  • if we want to run a custom lua code file, we can add dofile("yourfile.lua") into init.lua to let the board do so
  • example code hello world
 file.open("init.lua","w+")
 file.writeline([[print("hello world")]])
 file.writeline([[dofile("yourfile.lua")]])
 file.close()

Relevant Topics

Doc page

Git page

Hardware page

Firmware build

Documents

Modules

Useful link

Obselete

Module and library

  • U8G - display 128x64 OLED, example lua in nodemcu folder "nodemcu-firmware/lua_examples/u8glib/u8g_graphics_test.lua"
  • DHT22 - example avaialble

Pages in category "NodeMCU"

The following 2 pages are in this category, out of 2 total.