As the title says... Chat on...

User avatar
By Fab85
#13027 My DS18B20 temperature chip sometimes reads "85" at start-up and I don't wanna send this to my server. I created this simple piece of code. That needs to go in to deep sleep if received "85" and it does. But it also sends the data to thingspeak. This behavior is a little strange, because it should never get to this point. I noticed this behavior also when working with MQTT library functions, it would execute a function even do it should not get there yet. Did anyone notice this behavior? Is it part of LUA or nodeMCU? Is there a solution? Thnks

Code: Select allTEMP = 85

t=require("ds18b20")
t.setup(3)

TEMP = t.read(nil,t.C)

if TEMP == 85 then
     node.dsleep(60000000)
end

TEMP = string.format("%03.2f",TEMP)
print(TEMP)

t = nil
ds18b20 = nil
package.loaded["ds18b20"]=nil
dofile("ThingSpeaks.lua")