Merge pull request #817 from nickandrew/update-readme-2

Update readme 2
This commit is contained in:
Marcel Stör 2015-12-06 08:49:13 +01:00
commit 68eadaaf45
1 changed files with 45 additions and 16 deletions

View File

@ -4,11 +4,11 @@
[![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)
- Build on [ESP8266 NONOS 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)
- Open source development kit for NodeMCU [nodemcu-devkit-v0.9](https://github.com/nodemcu/nodemcu-devkit) [nodemcu-devkit-v1.0](https://github.com/nodemcu/nodemcu-devkit-v1.0)
# Summary
@ -33,15 +33,6 @@
| 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
- fix wifi smart connect
- add spi module (done)
- add mqtt module (done)
- add coap module (done)
- cross compiler (done)
# 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!
@ -220,8 +211,7 @@ There are several options for building the NodeMCU firmware.
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).
NodeMCU custom builds can build from the master branch and dev branch (with the latest fixes).
## Docker containerised build
@ -325,6 +315,16 @@ editing `app/include/user_config.h` and change BIT_RATE_DEFAULT, e.g.:
#define BIT_RATE_DEFAULT BIT_RATE_115200
```
## Debugging
To enable runtime debug messages to serial console, edit `app/include/user_config.h`
```c
#define DEVELOP_VERSION
```
`DEVELOP_VERSION` changes the startup baud rate to 74880.
# Flash the firmware
## Flash tools for Windows
@ -358,7 +358,8 @@ Otherwise, if you built your own firmware from source code:
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.
If upgrading from `spiffs` version 0.3.2 to 0.3.3 or later, or after flashing any new firmware (particularly one with a much different size), you may need to run `file.format()` to re-format your flash filesystem.
You will know if you need to do this because your flash files disappeared, or they exist but seem empty, or data cannot be written to new files.
# Connecting to your NodeMCU device
@ -616,7 +617,7 @@ cc:post(coap.NON, "coap://192.168.18.100:5683/", "Hello")
####cjson
```lua
-- Note that when cjson deal with large content, it may fails a memory allocation, and leaks a bit of memory.
-- so it's better to detect that and schedule a restart.
-- so it's better to detect that and schedule a restart.
--
-- Translate Lua value to/from JSON
-- text = cjson.encode(value)
@ -631,10 +632,38 @@ json_text = cjson.encode(value)
####Read an HX711 load cell ADC.
Note: currently only chanel A with gain 128 is supported.
The HX711 is an inexpensive 24bit ADC with programmable 128x, 64x, and 32x gain.
The HX711 is an inexpensive 24bit ADC with programmable 128x, 64x, and 32x gain.
```lua
-- Initialize the hx711 with clk on pin 5 and data on pin 6
hx711.init(5,6)
-- Read ch A with 128 gain.
raw_data = hx711.read(0)
```
####Universal DHT Sensor support
Support DHT11, DHT21, DHT22, DHT33, DHT44, etc.
Use all-in-one function to read DHT sensor.
```lua
pin = 5
status,temp,humi,temp_decimial,humi_decimial = dht.readxx(pin)
if( status == dht.OK ) then
-- Integer firmware using this example
print(
string.format(
"DHT Temperature:%d.%03d;Humidity:%d.%03d\r\n",
math.floor(temp),
temp_decimial,
math.floor(humi),
humi_decimial
)
)
-- Float firmware using this example
print("DHT Temperature:"..temp..";".."Humidity:"..humi)
elseif( status == dht.ERROR_CHECKSUM ) then
print( "DHT Checksum error." );
elseif( status == dht.ERROR_TIMEOUT ) then
print( "DHT Time out." );
end
```