From 1d8bec95253ee8a88a85cb88be521f28b23504aa Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 2 Oct 2015 23:52:52 +0200 Subject: wip of serial commands to mqtt bridge. --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca445c5 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# 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 + +# 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. + +# 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) + +# References + + * [Lua API](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en) -- cgit v1.2.3