From 7b65613498263a311685dcfe37c6b2af2233e744 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:00:12 +1100 Subject: [PATCH 01/17] Update README base to 1.4.0 Signed-off-by: Nick Andrew --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c49b870a..a40a8555 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -# **NodeMCU** # -version 0.9.5 +# **NodeMCU 1.4.0** # [![Join the chat at https://gitter.im/nodemcu/nodemcu-firmware](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nodemcu/nodemcu-firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware) [![Download](https://img.shields.io/badge/download-~400k-orange.svg)](https://github.com/nodemcu/nodemcu-firmware/releases/latest) ###A lua based firmware for wifi-soc esp8266 -Build on [ESP8266 sdk 0.9.5](http://bbs.espressif.com/viewtopic.php?f=5&t=154)
+Build on [ESP8266 sdk 1.4.0](http://bbs.espressif.com/viewtopic.php?f=46&t=1124)
Lua core based on [eLua project](http://www.eluaproject.net/)
cjson based on [lua-cjson](https://github.com/mpx/lua-cjson)
File system based on [spiffs](https://github.com/pellepl/spiffs)
From 64a2189556bf1421220fe50d00deef2f5f1aef1c Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:05:21 +1100 Subject: [PATCH 02/17] README: Clean up the language --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a40a8555..7509480b 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,22 @@ File system based on [spiffs](https://github.com/pellepl/spiffs)
Open source development kit for NodeMCU [nodemcu-devkit](https://github.com/nodemcu/nodemcu-devkit)
Flash tool for NodeMCU [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher)
-wiki: [NodeMCU wiki](https://github.com/nodemcu/nodemcu-firmware/wiki)
+Developer Wiki: (https://github.com/nodemcu/nodemcu-firmware/wiki)
api: [NodeMCU api](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en)
home: [nodemcu.com](http://www.nodemcu.com)
-bbs: [Chinese bbs](http://bbs.nodemcu.com)
+bbs: [Chinese BBS](http://bbs.nodemcu.com)
docs: [NodeMCU docs](http://www.nodemcu.com/docs/)
Tencent QQ group: 309957875
# Summary - Easy to access wireless router - Based on Lua 5.1.4 (without *debug, os* module.) -- Event-Drive programming preferred. -- Build-in json, file, timer, pwm, i2c, spi, 1-wire, net, mqtt, coap, gpio, wifi, adc, uart and system api. -- GPIO pin re-mapped, use the index to access gpio, i2c, pwm. -- Both Integer(less memory usage) and Float version firmware provided. +- Event-driven programming preferred +- Built-in modules: json, file, timer, pwm, i2c, spi, 1-wire, net, mqtt, coap, gpio, wifi, adc, uart and system api. +- GPIO pins re-mapped: use the index to access gpio, i2c, pwm. +- Both Integer (less memory usage) and Float version firmware provided. -# To Do List (pull requests are very welcomed) +# To Do List (pull requests are very welcome) - loadable c module - fix wifi smart connect - add spi module (done) From de634a95c3b0db61f2cea9f9dc8abc6ba656481d Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:05:53 +1100 Subject: [PATCH 03/17] README: Remove unnecessary changelog Changelog is in the git history, or major changes should be noted in CHANGELOG.md Signed-off-by: Nick Andrew --- README.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/README.md b/README.md index 7509480b..7ba8d6fb 100644 --- a/README.md +++ b/README.md @@ -34,44 +34,6 @@ Tencent QQ group: 309957875
- add coap module (done) - cross compiler (done) -# Change log -2015-06-27
-fixed ap/station-ap cannot connect to the device.
-added wifi.ap.getconfig().
-fixed net.dns.getdnsserver().
-added new base64 lua example.
-added node.bootreason() to inspect boot cause.
-optimization of u8g.
- -# Change log -2015-06-25
-move constants to ROM. Frees up 16k+ of RAM.
-add dhtlib for DHT11/21/22/33/44, port from Arduino.
-add 433MHz transmission.
-add crypto library.
-re-add ws2812.write().
-add wifi.getchannel.
-changed wifi_setip() to allow setting SoftAP gateway to 0.0.0.0.
-added net.dns.setdnsserver and net.dns.getdnsserver.
-add support for lm92 temperature sensor.
-implement getStrWidth() and setFontLineSpacingFactor().
-add -Os flag to release and debug builds.
-changed output format of table that is output by wifi_scan_done.
-added ability to set scan configuration to wifi.sta.getap.
-added function wifi.sta.getconfig().
-allow connecting to unsecured WiFi networks.
-add setphymode and getphymode to wifi module.
-add multicastJoin and multicastLeave to net module.
-add Yeelink Modules.
- -2015-03-31
-polish mqtt module, add queue for mqtt module.
-add reconnect option to mqtt.connect api, :connect( host, port, secure, auto_reconnect, function(client) )
-move node.readvdd33 to adc.readvdd33.
-tools/esptool.py supported NodeMCU devkit automatic flash. - -[more change log](https://github.com/nodemcu/nodemcu-firmware/wiki)
- ##GPIO NEW TABLE ( Build 20141219 and later) From b27fc6f50c5bbaecb95439b40e4c482a134b0b0f Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:15:10 +1100 Subject: [PATCH 04/17] README: Move the simple programming examples up The README is presently quite unreadable. The simpler examples of programming an already-flashed ESP8266 are moved up, to give the new user the flavor of what is possible with NodeMCU. Instructions to build the firmware will follow. Signed-off-by: Nick Andrew --- README.md | 334 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 171 insertions(+), 163 deletions(-) diff --git a/README.md b/README.md index 7ba8d6fb..d00d437d 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,177 @@ Tencent QQ group: 309957875
- add coap module (done) - cross compiler (done) -##GPIO NEW TABLE ( Build 20141219 and later) +# Programming Examples + +Because Lua is a high level language and several modules are built into the firmware, you can very easily program your ESP8266. Here are some examples! + +## Connect to your AP + +```lua + ip = wifi.sta.getip() + print(ip) + --nil + wifi.setmode(wifi.STATION) + wifi.sta.config("SSID","password") + ip = wifi.sta.getip() + print(ip) + --192.168.18.110 +``` + +## Manipulate hardware like an Arduino + +```lua + pin = 1 + gpio.mode(pin,gpio.OUTPUT) + gpio.write(pin,gpio.HIGH) + print(gpio.read(pin)) +``` + +## Write a network application in Node.js style + +```lua + -- A simple http client + conn=net.createConnection(net.TCP, 0) + conn:on("receive", function(conn, payload) print(payload) 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 + +```lua + -- A simple http server + srv=net.createServer(net.TCP) + srv:listen(80,function(conn) + conn:on("receive",function(conn,payload) + print(payload) + conn:send("

Hello, NodeMcu.

") + end) + conn:on("sent",function(conn) conn:close() end) + end) +``` + +## Connect to MQTT broker + +```lua +-- init mqtt client with keepalive timer 120sec +m = mqtt.Client("clientid", 120, "user", "password") + +-- setup Last Will and Testament (optional) +-- Broker will publish a message with qos = 0, retain = 0, data = "offline" +-- to topic "/lwt" if client don't send keepalive packet +m:lwt("/lwt", "offline", 0, 0) + +m:on("connect", function(con) print ("connected") end) +m:on("offline", function(con) print ("offline") end) + +-- on publish message receive event +m:on("message", function(conn, topic, data) + print(topic .. ":" ) + if data ~= nil then + print(data) + end +end) + +-- m:connect( host, port, secure, auto_reconnect, function(client) ) +-- for secure: m:connect("192.168.11.118", 1880, 1, 0) +-- for auto-reconnect: m:connect("192.168.11.118", 1880, 0, 1) +m:connect("192.168.11.118", 1880, 0, 0, function(conn) print("connected") end) + +-- subscribe topic with qos = 0 +m:subscribe("/topic",0, function(conn) print("subscribe success") end) +-- or subscribe multiple topic (topic/0, qos = 0; topic/1, qos = 1; topic2 , qos = 2) +-- m:subscribe({["topic/0"]=0,["topic/1"]=1,topic2=2}, function(conn) print("subscribe success") end) +-- publish a message with data = hello, QoS = 0, retain = 0 +m:publish("/topic","hello",0,0, function(conn) print("sent") end) + +m:close(); -- if auto-reconnect == 1, will disable auto-reconnect and then disconnect from host. +-- you can call m:connect again + +``` + +## UDP client and server + +```lua +-- a udp server +s=net.createServer(net.UDP) +s:on("receive",function(s,c) print(c) end) +s:listen(5683) + +-- a udp client +cu=net.createConnection(net.UDP) +cu:on("receive",function(cu,c) print(c) end) +cu:connect(5683,"192.168.18.101") +cu:send("hello") +``` + +## Do something shiny with an RGB LED + +```lua + function led(r,g,b) + pwm.setduty(1,r) + pwm.setduty(2,g) + pwm.setduty(3,b) + end + pwm.setup(1,500,512) + pwm.setup(2,500,512) + pwm.setup(3,500,512) + pwm.start(1) + pwm.start(2) + pwm.start(3) + led(512,0,0) -- red + led(0,0,512) -- blue +``` + +## And blink it + +```lua + lighton=0 + tmr.alarm(1,1000,1,function() + if lighton==0 then + lighton=1 + led(512,512,512) + else + lighton=0 + led(0,0,0) + end + end) +``` + +## If you want to run something when the system boots + +```lua + --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. +``` + +## Add a simple telnet server to the Lua interpreter + +```lua + -- a simple telnet server + s=net.createServer(net.TCP,180) + s:listen(2323,function(c) + function s_output(str) + if(c~=nil) + then c:send(str) + end + end + node.output(s_output, 0) -- re-direct output to function s_ouput. + c:on("receive",function(c,l) + node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line + end) + c:on("disconnection",function(c) + node.output(nil) -- un-regist the redirect output function, output goes to serial + end) + print("Welcome to NodeMcu world.") + end) +``` + +# GPIO NEW TABLE (Build 20141219 and later) @@ -130,168 +300,6 @@ Victor Brutskiy's [Esplorer](https://github.com/4refr0nt/ESPlorer) support most ####NodeMCU Studio [NodeMCU Studio](https://github.com/nodemcu/nodemcu-studio-csharp) is written in C# and support Windows. This software is opensource and can write lua files to filesystem. -#Start play - -####Connect to your ap - -```lua - ip = wifi.sta.getip() - print(ip) - --nil - wifi.setmode(wifi.STATION) - wifi.sta.config("SSID","password") - ip = wifi.sta.getip() - print(ip) - --192.168.18.110 -``` - -####Manipulate hardware like a arduino - -```lua - pin = 1 - gpio.mode(pin,gpio.OUTPUT) - gpio.write(pin,gpio.HIGH) - print(gpio.read(pin)) -``` - -####Write network application in nodejs style - -```lua - -- A simple http client - conn=net.createConnection(net.TCP, 0) - conn:on("receive", function(conn, payload) print(payload) 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 - -```lua - -- A simple http server - srv=net.createServer(net.TCP) - srv:listen(80,function(conn) - conn:on("receive",function(conn,payload) - print(payload) - conn:send("

Hello, NodeMcu.

") - end) - conn:on("sent",function(conn) conn:close() end) - end) -``` - -####Connect to MQTT Broker - -```lua --- init mqtt client with keepalive timer 120sec -m = mqtt.Client("clientid", 120, "user", "password") - --- setup Last Will and Testament (optional) --- Broker will publish a message with qos = 0, retain = 0, data = "offline" --- to topic "/lwt" if client don't send keepalive packet -m:lwt("/lwt", "offline", 0, 0) - -m:on("connect", function(con) print ("connected") end) -m:on("offline", function(con) print ("offline") end) - --- on publish message receive event -m:on("message", function(conn, topic, data) - print(topic .. ":" ) - if data ~= nil then - print(data) - end -end) - --- m:connect( host, port, secure, auto_reconnect, function(client) ) --- for secure: m:connect("192.168.11.118", 1880, 1, 0) --- for auto-reconnect: m:connect("192.168.11.118", 1880, 0, 1) -m:connect("192.168.11.118", 1880, 0, 0, function(conn) print("connected") end) - --- subscribe topic with qos = 0 -m:subscribe("/topic",0, function(conn) print("subscribe success") end) --- or subscribe multiple topic (topic/0, qos = 0; topic/1, qos = 1; topic2 , qos = 2) --- m:subscribe({["topic/0"]=0,["topic/1"]=1,topic2=2}, function(conn) print("subscribe success") end) --- publish a message with data = hello, QoS = 0, retain = 0 -m:publish("/topic","hello",0,0, function(conn) print("sent") end) - -m:close(); -- if auto-reconnect == 1, will disable auto-reconnect and then disconnect from host. --- you can call m:connect again - -``` - -#### UDP client and server -```lua --- a udp server -s=net.createServer(net.UDP) -s:on("receive",function(s,c) print(c) end) -s:listen(5683) - --- a udp client -cu=net.createConnection(net.UDP) -cu:on("receive",function(cu,c) print(c) end) -cu:connect(5683,"192.168.18.101") -cu:send("hello") -``` - -####Do something shining -```lua - function led(r,g,b) - pwm.setduty(1,r) - pwm.setduty(2,g) - pwm.setduty(3,b) - end - pwm.setup(1,500,512) - pwm.setup(2,500,512) - pwm.setup(3,500,512) - pwm.start(1) - pwm.start(2) - pwm.start(3) - led(512,0,0) -- red - led(0,0,512) -- blue -``` - -####And blink it -```lua - lighton=0 - tmr.alarm(1,1000,1,function() - if lighton==0 then - lighton=1 - led(512,512,512) - else - lighton=0 - led(0,0,0) - end - end) -``` - -####If you want to run something when system started -```lua - --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. -``` - -####With below code, you can telnet to your esp8266 now -```lua - -- a simple telnet server - s=net.createServer(net.TCP,180) - s:listen(2323,function(c) - function s_output(str) - if(c~=nil) - then c:send(str) - end - end - node.output(s_output, 0) -- re-direct output to function s_ouput. - c:on("receive",function(c,l) - node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line - end) - c:on("disconnection",function(c) - node.output(nil) -- un-regist the redirect output function, output goes to serial - end) - print("Welcome to NodeMcu world.") - end) -``` ####Use DS18B20 module extends your esp8266 ```lua From 1aa5efcba3561a15ea27737d1585ba9fb20f18b1 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:40:59 +1100 Subject: [PATCH 05/17] README: Add usable build instructions Put Marcel's online build server first, as this will be the go-to for new users. Note that they should build 'dev' not 'master'. Next, list the docker image which will build from your checked-out repository and possibly including your own changes. Finally, list the prerequisites if you want to build it all yourself, including the sequence of commands (same as the docker image uses). Signed-off-by: Nick Andrew --- README.md | 134 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 94 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index d00d437d..2dc82252 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,99 @@ cu:send("hello") end) ``` +# Building the firmware + +There are several options for building the NodeMCU firmware. + +## Online firmware custom build + +Please try Marcel's [NodeMCU custom builds](http://frightanic.com/nodemcu-custom-build) cloud service and you can choose only the modules you need, and download the firmware once built.
+ +NodeMCU custom builds can build from the master branch (0.9.6; deprecated) and dev +branch (1.4.0). + +## Docker containerised build + +See https://hub.docker.com/r/asmaps/nodemcu-builder/ + +This docker image includes the build toolchain and SDK. You just run the docker +image with your checked-out NodeMCU firmware repository (this one). The docker +image can also flash the firmware to your device. + +You will need to see BUILD OPTIONS below, to configure the firmware before building. + +## Build it yourself + +See BUILD OPTIONS below, to configure the firmware before building. + +### Minimum requirements: + + - unrar + - GNU autoconf, automake, libtool + - GNU gcc, g++, make + - GNU flex, bison, gawk, sed + - python, python-serial, libexpat-dev + - srecord + - The esp-open-sdk from https://github.com/pfalcon/esp-open-sdk.git + +### Build instructions: + +Assuming NodeMCU firmware is checked-out to /opt/nodemcu-firmware: + +```sh +git clone --recursive https://github.com/pfalcon/esp-open-sdk.git /opt/esp-open-sdk +cd /opt/esp-open-sdk +make STANDALONE=y +PATH=/opt/esp-open-sdk/xtensa-lx106-elf/bin:$PATH +cd /opt/nodemcu-firmware +make +``` + +# BUILD OPTIONS + +Disable modules you won't be using, to reduce firmware size on flash and +free more RAM. The ESP8266 is quite limited in available RAM, and running +out can cause a system panic. + +## Edit app/include/user_modules.h + +Comment-out the #define statement for unused modules. + +```c +#define LUA_USE_BUILTIN_STRING // for string.xxx() +#define LUA_USE_BUILTIN_TABLE // for table.xxx() +#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx() +#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work +// #define LUA_USE_BUILTIN_IO // for io.xxx(), partially work + +// #define LUA_USE_BUILTIN_OS // for os.xxx(), not work +// #define LUA_USE_BUILTIN_DEBUG // for debug.xxx(), not work + +#define LUA_USE_MODULES + +#ifdef LUA_USE_MODULES +#define LUA_USE_MODULES_NODE +#define LUA_USE_MODULES_FILE +#define LUA_USE_MODULES_GPIO +#define LUA_USE_MODULES_WIFI +#define LUA_USE_MODULES_NET +#define LUA_USE_MODULES_PWM +#define LUA_USE_MODULES_I2C +#define LUA_USE_MODULES_SPI +#define LUA_USE_MODULES_TMR +#define LUA_USE_MODULES_ADC +#define LUA_USE_MODULES_UART +#define LUA_USE_MODULES_OW +#define LUA_USE_MODULES_BIT +#define LUA_USE_MODULES_MQTT +// #define LUA_USE_MODULES_COAP +#define LUA_USE_MODULES_U8G +#define LUA_USE_MODULES_WS2812 +#define LUA_USE_MODULES_CJSON +#endif /* LUA_USE_MODULES */ +``` + + # GPIO NEW TABLE (Build 20141219 and later) @@ -238,46 +331,6 @@ cu:send("hello")
#### [*] D0(GPIO16) can only be used as gpio read/write. no interrupt supported. no pwm/i2c/ow supported. -#Build option -####file ./app/include/user_modules.h -```c -#define LUA_USE_BUILTIN_STRING // for string.xxx() -#define LUA_USE_BUILTIN_TABLE // for table.xxx() -#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx() -#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work -// #define LUA_USE_BUILTIN_IO // for io.xxx(), partially work - -// #define LUA_USE_BUILTIN_OS // for os.xxx(), not work -// #define LUA_USE_BUILTIN_DEBUG // for debug.xxx(), not work - -#define LUA_USE_MODULES - -#ifdef LUA_USE_MODULES -#define LUA_USE_MODULES_NODE -#define LUA_USE_MODULES_FILE -#define LUA_USE_MODULES_GPIO -#define LUA_USE_MODULES_WIFI -#define LUA_USE_MODULES_NET -#define LUA_USE_MODULES_PWM -#define LUA_USE_MODULES_I2C -#define LUA_USE_MODULES_SPI -#define LUA_USE_MODULES_TMR -#define LUA_USE_MODULES_ADC -#define LUA_USE_MODULES_UART -#define LUA_USE_MODULES_OW -#define LUA_USE_MODULES_BIT -#define LUA_USE_MODULES_MQTT -// #define LUA_USE_MODULES_COAP -#define LUA_USE_MODULES_U8G -#define LUA_USE_MODULES_WS2812 -#define LUA_USE_MODULES_CJSON -#endif /* LUA_USE_MODULES */ -``` -#Online firmware custom build - -For many application, some modules are not used, remove them can free many memory.
- -Please try Marcel's [NodeMCU custom builds](http://frightanic.com/nodemcu-custom-build) cloud service and you can get your own firmware.
#Flash the firmware nodemcu_latest.bin: 0x00000
@@ -300,6 +353,7 @@ Victor Brutskiy's [Esplorer](https://github.com/4refr0nt/ESPlorer) support most ####NodeMCU Studio [NodeMCU Studio](https://github.com/nodemcu/nodemcu-studio-csharp) is written in C# and support Windows. This software is opensource and can write lua files to filesystem. +# OPTIONAL MODULES ####Use DS18B20 module extends your esp8266 ```lua From 20bca021af5185df212525b2acf12a61c9e5e3aa Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:49:41 +1100 Subject: [PATCH 06/17] README: More work on the build options List the latest set of modules in the example on disabling modules. Show which file to edit to tag your firmware to identify it on boot. Signed-off-by: Nick Andrew --- README.md | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2dc82252..36ac5279 100644 --- a/README.md +++ b/README.md @@ -260,20 +260,9 @@ out can cause a system panic. ## Edit app/include/user_modules.h -Comment-out the #define statement for unused modules. +Comment-out the #define statement for unused modules. Example: ```c -#define LUA_USE_BUILTIN_STRING // for string.xxx() -#define LUA_USE_BUILTIN_TABLE // for table.xxx() -#define LUA_USE_BUILTIN_COROUTINE // for coroutine.xxx() -#define LUA_USE_BUILTIN_MATH // for math.xxx(), partially work -// #define LUA_USE_BUILTIN_IO // for io.xxx(), partially work - -// #define LUA_USE_BUILTIN_OS // for os.xxx(), not work -// #define LUA_USE_BUILTIN_DEBUG // for debug.xxx(), not work - -#define LUA_USE_MODULES - #ifdef LUA_USE_MODULES #define LUA_USE_MODULES_NODE #define LUA_USE_MODULES_FILE @@ -290,12 +279,36 @@ Comment-out the #define statement for unused modules. #define LUA_USE_MODULES_BIT #define LUA_USE_MODULES_MQTT // #define LUA_USE_MODULES_COAP -#define LUA_USE_MODULES_U8G -#define LUA_USE_MODULES_WS2812 -#define LUA_USE_MODULES_CJSON +// #define LUA_USE_MODULES_U8G +// #define LUA_USE_MODULES_WS2801 +// #define LUA_USE_MODULES_WS2812 +// #define LUA_USE_MODULES_CJSON +#define LUA_USE_MODULES_CRYPTO +#define LUA_USE_MODULES_RC +#define LUA_USE_MODULES_DHT +#define LUA_USE_MODULES_RTCMEM +#define LUA_USE_MODULES_RTCTIME +#define LUA_USE_MODULES_RTCFIFO +#define LUA_USE_MODULES_SNTP +// #define LUA_USE_MODULES_BMP085 +#define LUA_USE_MODULES_TSL2561 +// #define LUA_USE_MODULES_HX711 + #endif /* LUA_USE_MODULES */ ``` +## Tagging your build + +Identify your firmware builds by editing `app/include/user_version.h` + +```c +#define NODE_VERSION "NodeMCU 1.4.0+myname" +#ifndef BUILD_DATE +#define BUILD_DATE "YYYYMMDD" +#endif +``` + + # GPIO NEW TABLE (Build 20141219 and later) From c8f9f4ca205eb2c2d29c9f0daedb9de8263297f6 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:54:46 +1100 Subject: [PATCH 07/17] README: More tweaking of the summary text Add all the latest module names too. Signed-off-by: Nick Andrew --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 36ac5279..6d902939 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,16 @@ docs: [NodeMCU docs](http://www.nodemcu.com/docs/)
Tencent QQ group: 309957875
# Summary -- Easy to access wireless router + +- Easy to program wireless node and/or Access Point - Based on Lua 5.1.4 (without *debug, os* module.) -- Event-driven programming preferred -- Built-in modules: json, file, timer, pwm, i2c, spi, 1-wire, net, mqtt, coap, gpio, wifi, adc, uart and system api. +- Event-driven programming model preferred +- Built-in modules: node, json, file, timer, pwm, i2c, spi, onewire, net, mqtt, coap, gpio, wifi, adc, uart, bit, u8g, ucg, ws2801, ws2812, crypto, dht, rtc, sntp, bmp085, tls2561, hx711 and system api. - GPIO pins re-mapped: use the index to access gpio, i2c, pwm. - Both Integer (less memory usage) and Float version firmware provided. # To Do List (pull requests are very welcome) + - loadable c module - fix wifi smart connect - add spi module (done) From c1fd5d4ed21c86af1f0d98527ed558dbf7dba9d9 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 00:57:42 +1100 Subject: [PATCH 08/17] README: Temporarily remove the 'download' button Remove the download button until a 1.4.0 release is pushed to github. Signed-off-by: Nick Andrew --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d902939..68396111 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # **NodeMCU 1.4.0** # [![Join the chat at https://gitter.im/nodemcu/nodemcu-firmware](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nodemcu/nodemcu-firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware) [![Download](https://img.shields.io/badge/download-~400k-orange.svg)](https://github.com/nodemcu/nodemcu-firmware/releases/latest) +[![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware) ###A lua based firmware for wifi-soc esp8266 Build on [ESP8266 sdk 1.4.0](http://bbs.espressif.com/viewtopic.php?f=46&t=1124)
From 7b1a371192da1514d508294e5d4137ea640c58ef Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 01:04:44 +1100 Subject: [PATCH 09/17] README: Tidy the sample code Signed-off-by: Nick Andrew --- README.md | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 68396111..7e4c1cf9 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Because Lua is a high level language and several modules are built into the firm print(ip) --nil wifi.setmode(wifi.STATION) - wifi.sta.config("SSID","password") + wifi.sta.config("SSID", "password") ip = wifi.sta.getip() print(ip) --192.168.18.110 @@ -57,8 +57,8 @@ Because Lua is a high level language and several modules are built into the firm ```lua pin = 1 - gpio.mode(pin,gpio.OUTPUT) - gpio.write(pin,gpio.HIGH) + gpio.mode(pin, gpio.OUTPUT) + gpio.write(pin, gpio.HIGH) print(gpio.read(pin)) ``` @@ -67,10 +67,10 @@ Because Lua is a high level language and several modules are built into the firm ```lua -- A simple http client conn=net.createConnection(net.TCP, 0) - conn:on("receive", function(conn, payload) print(payload) end ) - conn:connect(80,"115.239.210.27") + conn:on("receive", function(conn, payload) print(payload) 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") + .. "Connection: keep-alive\r\nAccept: */*\r\n\r\n") ``` ## Or a simple HTTP server @@ -78,12 +78,12 @@ Because Lua is a high level language and several modules are built into the firm ```lua -- A simple http server srv=net.createServer(net.TCP) - srv:listen(80,function(conn) - conn:on("receive",function(conn,payload) + srv:listen(80, function(conn) + conn:on("receive", function(conn,payload) print(payload) - conn:send("

Hello, NodeMcu.

") + conn:send("

Hello, NodeMCU.

") end) - conn:on("sent",function(conn) conn:close() end) + conn:on("sent", function(conn) conn:close() end) end) ``` @@ -95,33 +95,33 @@ m = mqtt.Client("clientid", 120, "user", "password") -- setup Last Will and Testament (optional) -- Broker will publish a message with qos = 0, retain = 0, data = "offline" --- to topic "/lwt" if client don't send keepalive packet +-- to topic "/lwt" if client doesn't send keepalive packet m:lwt("/lwt", "offline", 0, 0) -m:on("connect", function(con) print ("connected") end) -m:on("offline", function(con) print ("offline") end) +m:on("connect", function(con) print("connected") end) +m:on("offline", function(con) print("offline") end) -- on publish message receive event m:on("message", function(conn, topic, data) - print(topic .. ":" ) + print(topic .. ":") if data ~= nil then print(data) end end) --- m:connect( host, port, secure, auto_reconnect, function(client) ) +-- m:connect(host, port, secure, auto_reconnect, function(client) end) -- for secure: m:connect("192.168.11.118", 1880, 1, 0) -- for auto-reconnect: m:connect("192.168.11.118", 1880, 0, 1) m:connect("192.168.11.118", 1880, 0, 0, function(conn) print("connected") end) --- subscribe topic with qos = 0 -m:subscribe("/topic",0, function(conn) print("subscribe success") end) --- or subscribe multiple topic (topic/0, qos = 0; topic/1, qos = 1; topic2 , qos = 2) +-- subscribe to topic with qos = 0 +m:subscribe("/topic", 0, function(conn) print("subscribe success") end) +-- or subscribe multiple topics (topic/0, qos = 0; topic/1, qos = 1; topic2, qos = 2) -- m:subscribe({["topic/0"]=0,["topic/1"]=1,topic2=2}, function(conn) print("subscribe success") end) -- publish a message with data = hello, QoS = 0, retain = 0 -m:publish("/topic","hello",0,0, function(conn) print("sent") end) +m:publish("/topic", "hello", 0, 0, function(conn) print("sent") end) -m:close(); -- if auto-reconnect == 1, will disable auto-reconnect and then disconnect from host. +m:close(); -- if auto-reconnect == 1, it will disable auto-reconnect and then disconnect from host. -- you can call m:connect again ``` @@ -131,45 +131,45 @@ m:close(); -- if auto-reconnect == 1, will disable auto-reconnect and then disc ```lua -- a udp server s=net.createServer(net.UDP) -s:on("receive",function(s,c) print(c) end) +s:on("receive", function(s, c) print(c) end) s:listen(5683) -- a udp client cu=net.createConnection(net.UDP) -cu:on("receive",function(cu,c) print(c) end) -cu:connect(5683,"192.168.18.101") +cu:on("receive", function(cu, c) print(c) end) +cu:connect(5683, "192.168.18.101") cu:send("hello") ``` ## Do something shiny with an RGB LED ```lua - function led(r,g,b) - pwm.setduty(1,r) - pwm.setduty(2,g) - pwm.setduty(3,b) + function led(r, g, b) + pwm.setduty(1, r) + pwm.setduty(2, g) + pwm.setduty(3, b) end - pwm.setup(1,500,512) - pwm.setup(2,500,512) - pwm.setup(3,500,512) + pwm.setup(1, 500, 512) + pwm.setup(2, 500, 512) + pwm.setup(3, 500, 512) pwm.start(1) pwm.start(2) pwm.start(3) - led(512,0,0) -- red - led(0,0,512) -- blue + led(512, 0, 0) -- red + led(0, 0, 512) -- blue ``` ## And blink it ```lua lighton=0 - tmr.alarm(1,1000,1,function() + tmr.alarm(1, 1000, 1, function() if lighton==0 then lighton=1 - led(512,512,512) + led(512, 512, 512) else lighton=0 - led(0,0,0) + led(0, 0, 0) end end) ``` @@ -177,8 +177,8 @@ cu:send("hello") ## If you want to run something when the system boots ```lua - --init.lua will be excuted - file.open("init.lua","w") + --init.lua will be executed + file.open("init.lua", "w") file.writeline([[print("Hello, do this at the beginning.")]]) file.close() node.restart() -- this will restart the module. @@ -188,21 +188,21 @@ cu:send("hello") ```lua -- a simple telnet server - s=net.createServer(net.TCP,180) - s:listen(2323,function(c) + s=net.createServer(net.TCP, 180) + s:listen(2323, function(c) function s_output(str) if(c~=nil) then c:send(str) end end node.output(s_output, 0) -- re-direct output to function s_ouput. - c:on("receive",function(c,l) - node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line + c:on("receive", function(c, l) + node.input(l) -- works like pcall(loadstring(l)) but support multiples separate lines end) - c:on("disconnection",function(c) - node.output(nil) -- un-regist the redirect output function, output goes to serial + c:on("disconnection", function(c) + node.output(nil) -- un-register the redirect output function, output goes to serial end) - print("Welcome to NodeMcu world.") + print("Welcome to NodeMCU world.") end) ``` From e9091cc3647418da1d7a3f6ffa3c9ab240f7a14c Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 01:13:33 +1100 Subject: [PATCH 10/17] README: Remove GPIO NEW TABLE It's in the API documentation and doesn't belong in the top-level README. Signed-off-by: Nick Andrew --- README.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/README.md b/README.md index 7e4c1cf9..89c241c5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ Tencent QQ group: 309957875
- Based on Lua 5.1.4 (without *debug, os* module.) - Event-driven programming model preferred - Built-in modules: node, json, file, timer, pwm, i2c, spi, onewire, net, mqtt, coap, gpio, wifi, adc, uart, bit, u8g, ucg, ws2801, ws2812, crypto, dht, rtc, sntp, bmp085, tls2561, hx711 and system api. -- GPIO pins re-mapped: use the index to access gpio, i2c, pwm. - Both Integer (less memory usage) and Float version firmware provided. # To Do List (pull requests are very welcome) @@ -310,43 +309,6 @@ Identify your firmware builds by editing `app/include/user_version.h` #endif ``` - - -# GPIO NEW TABLE (Build 20141219 and later) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IO indexESP8266 pinIO indexESP8266 pin
0 [*]GPIO168GPIO15 (SPI CS)
1GPIO59GPIO3 (UART RX)
2GPIO410GPIO1 (UART TX)
3GPIO011GPIO9
4GPIO212GPIO10
5GPIO14 (SPI CLK)
6GPIO12 (SPI MISO)
7GPIO13 (SPI MOSI)
-#### [*] D0(GPIO16) can only be used as gpio read/write. no interrupt supported. no pwm/i2c/ow supported. - - #Flash the firmware nodemcu_latest.bin: 0x00000
for most esp8266 modules, just pull GPIO0 down and restart.
From 7731592b7017ddf64ced3b9eb5e97ff3affebaf7 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 02:44:49 +1100 Subject: [PATCH 11/17] README: Update building and flashing instructions Make it more obvious to run file.format() after flashing. Signed-off-by: Nick Andrew --- README.md | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 89c241c5..b71d098f 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ See BUILD OPTIONS below, to configure the firmware before building. - GNU flex, bison, gawk, sed - python, python-serial, libexpat-dev - srecord - - The esp-open-sdk from https://github.com/pfalcon/esp-open-sdk.git + - The esp-open-sdk from https://github.com/pfalcon/esp-open-sdk ### Build instructions: @@ -309,16 +309,40 @@ Identify your firmware builds by editing `app/include/user_version.h` #endif ``` -#Flash the firmware -nodemcu_latest.bin: 0x00000
-for most esp8266 modules, just pull GPIO0 down and restart.
+# Flash the firmware + +## Flash tools for Windows + You can use the [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher) to burn the firmware. -Or, if you build your own bin from source code.
-0x00000.bin: 0x00000
-0x10000.bin: 0x10000
+## Flash tools for Linux -*Better run file.format() after flash* +Esptool is a python utility which can read and write the flash in an ESP8266 device. See https://github.com/themadinventor/esptool + +## Preparing the hardware for firmware upgrade + +To enable ESP8266 firmware flashing, the GPIO0 pin must be pulled low before +the device is reset. Conversely, for a normal boot, GPIO0 must be pulled high +or floating. + +If you have a [NodeMCU Development Kit](http://www.nodemcu.com/index_en.html) then +you don't need to do anything, as the USB connection can pull GPIO0 +low by asserting DTR, and reset your board by asserting RTS. + +If you have an ESP-01 or other device without inbuilt USB, you will need to +enable flashing yourself by pulling GPIO0 low or pressing a "flash" switch. + +## Files to burn to the flash + +If you got your firmware from [NodeMCU custom builds](http://frightanic.com/nodemcu-custom-build) then you can flash that file directly to address 0x00000. + +Otherwise, if you built your own firmware from source code: + - bin/0x00000.bin to 0x00000 + - bin/0x10000.bin to 0x10000 + +Also, in some special circumstances, you may need to flash `blank.bin` or `esp_init_data_default.bin` to various addresses on the flash. + +If upgrading from `spiffs` version 0.3.2 to 0.3.3 or later, or after flashing any new firmware, you should run `file.format()` to re-format your flash filesystem. #Connect the hardware in serial baudrate:9600 From 7d05a25b653518df1c1dfbccaf1713e1be1e9d0c Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:09:57 +1100 Subject: [PATCH 12/17] README: Flashing and connecting Signed-off-by: Nick Andrew --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b71d098f..61ec7d22 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ See BUILD OPTIONS below, to configure the firmware before building. ### Build instructions: -Assuming NodeMCU firmware is checked-out to /opt/nodemcu-firmware: +Assuming NodeMCU firmware is checked-out to `/opt/nodemcu-firmware`: ```sh git clone --recursive https://github.com/pfalcon/esp-open-sdk.git /opt/esp-open-sdk @@ -259,7 +259,7 @@ Disable modules you won't be using, to reduce firmware size on flash and free more RAM. The ESP8266 is quite limited in available RAM, and running out can cause a system panic. -## Edit app/include/user_modules.h +## Edit `app/include/user_modules.h` Comment-out the #define statement for unused modules. Example: @@ -340,12 +340,15 @@ Otherwise, if you built your own firmware from source code: - bin/0x00000.bin to 0x00000 - bin/0x10000.bin to 0x10000 -Also, in some special circumstances, you may need to flash `blank.bin` or `esp_init_data_default.bin` to various addresses on the flash. +Also, in some special circumstances, you may need to flash `blank.bin` or `esp_init_data_default.bin` to various addresses on the flash (depending on flash size and type). If upgrading from `spiffs` version 0.3.2 to 0.3.3 or later, or after flashing any new firmware, you should run `file.format()` to re-format your flash filesystem. -#Connect the hardware in serial -baudrate:9600 +# Connecting to your NodeMCU device + +NodeMCU serial interface uses 9600 baud at boot time. To increase the speed after booting, issue `uart.setup(0, 115200, 8, 0, 1, 1 )` (ESPlorer will do this automatically when changing the speed in the dropdown list). + +If the device panics and resets, errors will be written to the serial interface at 115200 bps. #Write Lua script to filesystem ####Esplorer From 81db4ae6bfdd237f4f1a1428c437ddcdc9d186ef Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:11:48 +1100 Subject: [PATCH 13/17] README: Remove the
tags Change to Markdown list or table. Signed-off-by: Nick Andrew --- README.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 61ec7d22..f27e7d5a 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,23 @@ [![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware) ###A lua based firmware for wifi-soc esp8266 -Build on [ESP8266 sdk 1.4.0](http://bbs.espressif.com/viewtopic.php?f=46&t=1124)
-Lua core based on [eLua project](http://www.eluaproject.net/)
-cjson based on [lua-cjson](https://github.com/mpx/lua-cjson)
-File system based on [spiffs](https://github.com/pellepl/spiffs)
-Open source development kit for NodeMCU [nodemcu-devkit](https://github.com/nodemcu/nodemcu-devkit)
-Flash tool for NodeMCU [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher)
+ - Build on [ESP8266 sdk 1.4.0](http://bbs.espressif.com/viewtopic.php?f=46&t=1124) + - Lua core based on [eLua project](http://www.eluaproject.net/) + - cjson based on [lua-cjson](https://github.com/mpx/lua-cjson) + - File system based on [spiffs](https://github.com/pellepl/spiffs) + - Open source development kit for NodeMCU [nodemcu-devkit](https://github.com/nodemcu/nodemcu-devkit) + - Flash tool for NodeMCU [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher) -Developer Wiki: (https://github.com/nodemcu/nodemcu-firmware/wiki)
-api: [NodeMCU api](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en)
-home: [nodemcu.com](http://www.nodemcu.com)
-bbs: [Chinese BBS](http://bbs.nodemcu.com)
-docs: [NodeMCU docs](http://www.nodemcu.com/docs/)
-Tencent QQ group: 309957875
+### Resources + +| Resource | Location | +| -------------- | -------------- | +| Developer Wiki | https://github.com/nodemcu/nodemcu-firmware/wiki | +| api | [NodeMCU api](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en) | +| home | [nodemcu.com](http://www.nodemcu.com) | +| bbs | [Chinese BBS](http://bbs.nodemcu.com) | +| docs | [NodeMCU docs](http://www.nodemcu.com/docs/) | +| Tencent QQ group | 309957875 | # Summary @@ -211,7 +215,7 @@ There are several options for building the NodeMCU firmware. ## Online firmware custom build -Please try Marcel's [NodeMCU custom builds](http://frightanic.com/nodemcu-custom-build) cloud service and you can choose only the modules you need, and download the firmware once built.
+Please try Marcel's [NodeMCU custom builds](http://frightanic.com/nodemcu-custom-build) cloud service and you can choose only the modules you need, and download the firmware once built. NodeMCU custom builds can build from the master branch (0.9.6; deprecated) and dev branch (1.4.0). From e1e1cde8f8865435408d529a8910ed3557c54250 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:36:19 +1100 Subject: [PATCH 14/17] README: Expand and update the Resources list Signed-off-by: Nick Andrew --- README.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f27e7d5a..7fff744d 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,6 @@ - cjson based on [lua-cjson](https://github.com/mpx/lua-cjson) - File system based on [spiffs](https://github.com/pellepl/spiffs) - Open source development kit for NodeMCU [nodemcu-devkit](https://github.com/nodemcu/nodemcu-devkit) - - Flash tool for NodeMCU [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher) - -### Resources - -| Resource | Location | -| -------------- | -------------- | -| Developer Wiki | https://github.com/nodemcu/nodemcu-firmware/wiki | -| api | [NodeMCU api](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en) | -| home | [nodemcu.com](http://www.nodemcu.com) | -| bbs | [Chinese BBS](http://bbs.nodemcu.com) | -| docs | [NodeMCU docs](http://www.nodemcu.com/docs/) | -| Tencent QQ group | 309957875 | # Summary @@ -30,6 +18,21 @@ - Built-in modules: node, json, file, timer, pwm, i2c, spi, onewire, net, mqtt, coap, gpio, wifi, adc, uart, bit, u8g, ucg, ws2801, ws2812, crypto, dht, rtc, sntp, bmp085, tls2561, hx711 and system api. - Both Integer (less memory usage) and Float version firmware provided. +## Useful links + +| Resource | Location | +| -------------- | -------------- | +| Developer Wiki | https://github.com/nodemcu/nodemcu-firmware/wiki | +| API docs | [NodeMCU api](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en) | +| Home | [nodemcu.com](http://www.nodemcu.com) | +| BBS | [Chinese BBS](http://bbs.nodemcu.com) | +| Docs | [NodeMCU docs](http://www.nodemcu.com/docs/) | +| Tencent QQ group | 309957875 | +| Windows flash tool | [nodemcu-flasher](https://github.com/nodemcu/nodemcu-flasher) | +| Linux flash tool | [Esptool](https://github.com/themadinventor/esptool) | +| ESPlorer GUI | https://github.com/4refr0nt/ESPlorer | +| NodeMCU Studio GUI | https://github.com/nodemcu/nodemcu-studio-csharp | + # To Do List (pull requests are very welcome) - loadable c module From 44adcd5f7e971cb4da7cae71345d2a175958ecfd Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:44:10 +1100 Subject: [PATCH 15/17] README: Setting the initial serial interface rate Signed-off-by: Nick Andrew --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7fff744d..8067359b 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,15 @@ Identify your firmware builds by editing `app/include/user_version.h` #endif ``` +## Setting the boot time serial interface rate + +The initial baud rate at boot time is 9600 bps, but you can change this by +editing `app/include/user_config.h` and change BIT_RATE_DEFAULT, e.g.: + +```c +#define BIT_RATE_DEFAULT BIT_RATE_115200 +``` + # Flash the firmware ## Flash tools for Windows From 8eb3fbafd9e887f8f6e09e55f58a05435c72be4d Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:49:23 +1100 Subject: [PATCH 16/17] README: Tidy up the user interface tools Signed-off-by: Nick Andrew --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8067359b..eefa6828 100644 --- a/README.md +++ b/README.md @@ -366,12 +366,21 @@ NodeMCU serial interface uses 9600 baud at boot time. To increase the speed afte If the device panics and resets, errors will be written to the serial interface at 115200 bps. -#Write Lua script to filesystem -####Esplorer -Victor Brutskiy's [Esplorer](https://github.com/4refr0nt/ESPlorer) support most platforms such as Linux, Windows, Mac OS, etc. This software is opensource and can write lua/lc files to filesystem. +# User Interface tools -####NodeMCU Studio -[NodeMCU Studio](https://github.com/nodemcu/nodemcu-studio-csharp) is written in C# and support Windows. This software is opensource and can write lua files to filesystem. +## Esplorer + +Victor Brutskiy's [ESPlorer](https://github.com/4refr0nt/ESPlorer) is written in Java, is open source and runs on most platforms such as Linux, Windows, Mac OS, etc. + +#### Features + + - Edit Lua scripts and run on the ESP8266 and save to its flash + - Serial console log + - Also supports original AT firmware (reading and setting WiFi modes, etc) + +## NodeMCU Studio + +[NodeMCU Studio](https://github.com/nodemcu/nodemcu-studio-csharp) is written in C# and supports Windows. This software is open source and can write lua files to filesystem. # OPTIONAL MODULES From 703d55da822c4d4929223ae852cc227b214c70e9 Mon Sep 17 00:00:00 2001 From: Nick Andrew Date: Tue, 17 Nov 2015 03:51:56 +1100 Subject: [PATCH 17/17] README: Tidy ugly looking uart.setup() call Signed-off-by: Nick Andrew --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eefa6828..ecfc81c8 100644 --- a/README.md +++ b/README.md @@ -362,9 +362,9 @@ If upgrading from `spiffs` version 0.3.2 to 0.3.3 or later, or after flashing an # Connecting to your NodeMCU device -NodeMCU serial interface uses 9600 baud at boot time. To increase the speed after booting, issue `uart.setup(0, 115200, 8, 0, 1, 1 )` (ESPlorer will do this automatically when changing the speed in the dropdown list). +NodeMCU serial interface uses 9600 baud at boot time. To increase the speed after booting, issue `uart.setup(0,115200,8,0,1,1)` (ESPlorer will do this automatically when changing the speed in the dropdown list). -If the device panics and resets, errors will be written to the serial interface at 115200 bps. +If the device panics and resets at any time, errors will be written to the serial interface at 115200 bps. # User Interface tools