NodeMCU (LUA)
NodeMCU (LUA)
This page is to Setup and Config NodeMCU
Hardware and Software
Hardware
NodeMCU
Software
Arduino IDE
Notes
Good For MAC
Manual Install and Flash : https://nodemcu.readthedocs.io/en/dev/en/flash/
Install Python
Full DOC : https://github.com/themadinventor/esptool#flash-modes
E.g.
esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -fm qio -fs 32m 0x00000 nodemcuflash.bin
--------------------------------------------------------------------------------
Firmware : https://github.com/nodemcu/nodemcu-firmware/tree/master
https://github.com/nodemcu/nodemcu-firmware
Build a Firware : http://nodemcu-build.com/
Doc : https://nodemcu.readthedocs.io/en/dev/en
https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_cn#wifistartsmart
Flash : https://github.com/nodemcu
https://github.com/nodemcu/nodemcu-flasher
Offical Site : http://www.nodemcu.com/index_en.html
Steps :
Create your own Firmware : http://nodemcu-build.com/index.php
Use flasher to download to ESP8266 (ESP01 or NODEMCU)
THIS IS ONLY FOR LUA
After Boot
NodeMCU custom build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: false
modules: bit,coap,crypto,file,gpio,i2c,net,node,ow,pwm,spi,tmr,u8g,uart,wifi,ws2801,ws2812
build built on: 2016-05-30 07:22
powered by Lua 5.1.4 on SDK 1.4.0
Examples
This example is lua file for esp01 or nodemcu lua flasher formated
Module - Description
wifi.setmode(wifi.STATION)
wifi.sta.config("SweetHome","parc362a")
print(wifi.sta.getip())
led1 = 3
led2 = 4
gpio.mode(led1, gpio.OUTPUT)
gpio.mode(led2, gpio.OUTPUT)
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
local buf = "";
local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
end
local _GET = {}
if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end
buf = buf.."<h1> ESP8266 Web Server</h1>";
buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a> <a href=\"?pin=OFF1\"><button>OFF</button></a></p>";
buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a> <a href=\"?pin=OFF2\"><button>OFF</button></a></p>";
local _on,_off = "",""
if(_GET.pin == "ON1")then
gpio.write(led1, gpio.HIGH);
elseif(_GET.pin == "OFF1")then
gpio.write(led1, gpio.LOW);
elseif(_GET.pin == "ON2")then
gpio.write(led2, gpio.HIGH);
elseif(_GET.pin == "OFF2")then
gpio.write(led2, gpio.LOW);
end
client:send(buf);
client:close();
collectgarbage();
end)
end)
Update Fameware on 2016 08 18