From 2222995af4bfbbde54dcce4f88140e99225ea26e Mon Sep 17 00:00:00 2001 From: HuangRui Date: Tue, 9 Dec 2014 14:41:14 +0800 Subject: [PATCH] * Update README.md and DS18B20 documents. --- README.md | 28 +++++++++++++++++++++++++++- modules/ds18b20.CN.md | 8 ++++---- modules/ds18b20.EN.md | 8 ++++---- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2f4e1fc6..118a86d0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ version 0.9.2 build 2014-12-09 # Change log 2014-12-09
-increase alarmer num in tmr module to 7. +increased the number of alarm in tmr module, now it has 7 alarm.
2014-12-08
add uart.setup(), uart.write() api.
@@ -164,6 +164,32 @@ braudrate:9600 print("Welcome to NodeMcu world.") end) ``` + +####Use DS18B20 module extends your NODEMCU +```lua + -- read temperature with DS18B20 + t=require("ds18b20") + t.setup(9) + addrs=t.addrs() + -- Total DS18B20 numbers, assume it is 2 + print(table.getn(addrs)) + -- The first DS18B20 + print(t.read(addrs[1],t.C)) + print(t.read(addrs[1],t.F)) + print(t.read(addrs[1],t.K)) + -- The second DS18B20 + print(t.read(addrs[2],t.C)) + print(t.read(addrs[2],t.F)) + print(t.read(addrs[2],t.K)) + -- Just read + print(t.read()) + -- Just read as centigrade + print(t.read(nil,t.C)) + -- Don't forget to release it after use + t = nil + package.loaded["ds18b20"]=nil +``` + #Check this out Tencent QQ group: 309957875
[nodemcu wiki](https://github.com/nodemcu/nodemcu-firmware/wiki)
diff --git a/modules/ds18b20.CN.md b/modules/ds18b20.CN.md index c2543fed..a7fba72d 100644 --- a/modules/ds18b20.CN.md +++ b/modules/ds18b20.CN.md @@ -29,7 +29,7 @@ nil ```lua ds18b20 = require("ds18b20") ds18b20.setup(9) --- Don't forget release it after use +-- Don't forget to release it after use ds18b20 = nil package.loaded["ds18b20"]=nil @@ -60,7 +60,7 @@ addrs = ds18b20.addrs() if (addrs ~= nil) then print("Total DS18B20 sensors: "..table.getn(addrs)) end --- Don't forget release it after use +-- Don't forget to release it after use ds18b20 = nil package.loaded["ds18b20"]=nil @@ -107,7 +107,7 @@ print(t.readNumber()) print(t.readNumber(nil,t.F)) -- Read as values t1, t2 = t.readNumber() --- Don't forget release it after use +-- Don't forget to release it after use t = nil package.loaded["ds18b20"]=nil @@ -149,7 +149,7 @@ print(t.read(addrs[2],t.K)) print(t.read()) -- Just read as centigrade print(t.read(nil,t.C)) --- Don't forget release it after use +-- Don't forget to release it after use t = nil package.loaded["ds18b20"]=nil ``` diff --git a/modules/ds18b20.EN.md b/modules/ds18b20.EN.md index 74cdcac4..c887dab3 100644 --- a/modules/ds18b20.EN.md +++ b/modules/ds18b20.EN.md @@ -29,7 +29,7 @@ nil ```lua ds18b20 = require("ds18b20") ds18b20.setup(9) --- Don't forget release it after use +-- Don't forget to release it after use ds18b20 = nil package.loaded["ds18b20"]=nil ``` @@ -59,7 +59,7 @@ addrs = ds18b20.addrs() if (addrs ~= nil) then print("Total DS18B20 sensors: "..table.getn(addrs)) end --- Don't forget release it after use +-- Don't forget to release it after use ds18b20 = nil package.loaded["ds18b20"]=nil ``` @@ -105,7 +105,7 @@ print(t.readNumber()) print(t.readNumber(nil,t.F)) -- Read as values t1, t2 = t.readNumber() --- Don't forget release it after use +-- Don't forget to release it after use t = nil package.loaded["ds18b20"]=nil ``` @@ -146,7 +146,7 @@ print(t.read(addrs[2],t.K)) print(t.read()) -- Just read as centigrade print(t.read(nil,t.C)) --- Don't forget release it after use +-- Don't forget to release it after use t = nil package.loaded["ds18b20"]=nil ```