Left here for archival purposes.

User avatar
By jankop
#12063 I read periodically sensor, everything is fine and suddenly result incomprehensible infinity .
What to do?

Code: Select allCode...
function ReadHTU()
    htu=require("htu21")
   htu.init(sda,scl)
   humi=htu.getHumidity()
   temp=htu.getTemperature()
   fare=(temp*9/5+32)
   print("Humidity:    "..string.format("%.1f",humi).."%")
   print("Temperature: "..string.format("%.1f",temp).." deg C")
   print("Temperature: "..string.format("%.1f",fare).." deg F")
   -- release module
   htu=nil
   package.loaded["htu"]=nil
   end

and Output......
NodeMCU 0.9.5 build 20150311  powered by Lua 5.1.4
I2C init done
Humidity:    51.8%
Temperature: 22.6 deg C
Temperature: 72.6 deg F
Wake up run 4.7 s
>
Hard Restart 16. březen 2015  19:31:54
I2C init done
Humidity:    51.8%
Temperature: Infinity deg C
Temperature: 72.6 deg F

Wake up run 4.8 s
User avatar
By jankop
#12661 Version 20150213 has problems with arithmetic (not with wakeup) and later versions (0.9.5_20150318 for example) have major problems with excitation from a deep sleep. I do not know why this is. I lost a lot of time with it, but without effect. Just after a few minutes or hours to stop the wakeup. Zombie returns!