# Required Tools ## Installing `esptool` $ git clone https://github.com/themadinventor/esptool.git $ cd esptool $ python setup.py install -local ## NodeMCU Uploader This tool uploads the Lua files. Requires that the device is runnig the Lua firmware. $ git clone https://github.com/kmpm/nodemcu-uploader.git $ cd nodemcu-uploader https://github.com/nodemcu/nodemcu-firmware # Installing Lua Interpreter 1. Download a release from https://github.com/nodemcu/nodemcu-firmware/releases 1. Check that you have a connection to the board: $ esptool.py read_mac Connecting... MAC: 18:fe:34:06:59:a5 1. Upload firmware $ esptool.py write_flash 0x0 nodemcu_integer_0.9.6-dev_20150704.bin Connecting... Erasing flash... Wrote 450560 bytes at 0x00000000 in 43.8 seconds (82.4 kbit/s)... Leaving... 1. Now start talking! # Talking to the Lua firmware On unix Screen is a useful tool to talk to serial ports. Usage: $ screen $ screen /dev/ttyUSB0 9600 After starting screen and pressing reset you should get some output similar to this: <��������������x� NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4 lua: cannot open init.lua > The first garbage output is expected and is from the bootloader trying to autodetect the baud rate. # Installing eLua cross-compiler (optional) git clone https://github.com/elua/elua.git # First Code Open screen and paste this code: -- Get the current IP ip = wifi.sta.getip() -- This should print nil print(ip) -- Configure the device wifi.setmode(wifi.STATION) wifi.sta.config("...", "...") -- Now check that the IP is assigned. It might take some time so try again. ip = wifi.sta.getip() print(ip) # Building a new Lua firmware ## Build and install the compiler and SDK $ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git $ cd esp-open-sdk $ make STANDALONE=n .. wait a while .. Add the compiler to your $PATH (see output) $ cd .. $ git clone https://github.com/nodemcu/nodemcu-firmware $ cd nodemcu-firmware $ make # References * [Lua API](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en) * * * http://blog.3mdeb.com/2015/01/25/esp-12-upgrade-to-esp-iot-sdk-v0-dot-9-5-using-esp-open-sdk-toolchain/