diff --git a/0.9.2/512k-flash/nodemcu_512k.bin b/0.9.2/512k-flash/nodemcu_512k.bin index d8371e03..65a70e58 100644 Binary files a/0.9.2/512k-flash/nodemcu_512k.bin and b/0.9.2/512k-flash/nodemcu_512k.bin differ diff --git a/README.md b/README.md index 9d15998b..6eddb6e8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # **NodeMcu** # ###A lua based firmware for wifi-soc esp8266 -version 0.9.2 build 2014-12-04 +version 0.9.2 build 2014-12-07 # Change log -2014-12-04
-fix memory leak issue when input and run from console. +2014-12-07
+add ow(1-wire module), from arduino, and use same api.
+add an 18b20 1-wire example.
+change net.socket.send() payload max len from 256 to 1460. [more change log](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#change_log)
[更多变更日志](https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_cn#change_log) @@ -11,7 +13,7 @@ fix memory leak issue when input and run from console. - Easy to access wireless router - Based on Lua 5.1.4 - Event-Drive programming preferred. -- Build-in file, timer, pwm, i2c, net, gpio, wifi, adc, uart and system api. +- Build-in file, timer, pwm, i2c, 1-wire, net, gpio, wifi, adc, uart and system api. - GPIO pin re-mapped, use the index to access gpio, i2c, pwm. - GPIO Map Table: diff --git a/examples/ds18b20.lua b/examples/ds18b20.lua new file mode 100644 index 00000000..ed29efa4 --- /dev/null +++ b/examples/ds18b20.lua @@ -0,0 +1,50 @@ +-- 18b20 Example +pin = 9 +ow.setup(pin) +count = 0 +repeat + count = count + 1 + addr = ow.reset_search(pin) + addr = ow.search(pin) + tmr.wdclr() +until((addr ~= nil) or (count > 100)) +if (addr == nil) then + print("No more addresses.") +else + print(addr:byte(1,8)) + crc = ow.crc8(string.sub(addr,1,7)) + if (crc == addr:byte(8)) then + if ((addr:byte(1) == 0x10) or (addr:byte(1) == 0x28)) then + print("Device is a DS18S20 family device.") + repeat + ow.reset(pin) + ow.select(pin, addr) + ow.write(pin, 0x44, 1) + tmr.delay(1000000) + present = ow.reset(pin) + ow.select(pin, addr) + ow.write(pin,0xBE,1) + print("P="..present) + data = nil + data = string.char(ow.read(pin)) + for i = 1, 8 do + data = data .. string.char(ow.read(pin)) + end + print(data:byte(1,9)) + crc = ow.crc8(string.sub(data,1,8)) + print("CRC="..crc) + if (crc == data:byte(9)) then + t = (data:byte(1) + data:byte(2) * 256) * 625 + t1 = t / 10000 + t2 = t % 10000 + print("Temperature="..t1.."."..t2.."Centigrade") + end + tmr.wdclr() + until false + else + print("Device family is not recognized.") + end + else + print("CRC is not valid!") + end +end \ No newline at end of file