* Update README.md and DS18B20 documents.
This commit is contained in:
parent
30a7274083
commit
2222995af4
28
README.md
28
README.md
|
@ -3,7 +3,7 @@
|
|||
version 0.9.2 build 2014-12-09
|
||||
# Change log
|
||||
2014-12-09<br />
|
||||
increase alarmer num in tmr module to 7.
|
||||
increased the number of alarm in tmr module, now it has 7 alarm. <br />
|
||||
|
||||
2014-12-08<br />
|
||||
add uart.setup(), uart.write() api.<br />
|
||||
|
@ -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<br/>
|
||||
[nodemcu wiki](https://github.com/nodemcu/nodemcu-firmware/wiki)<br/>
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue