Post your best Lua script examples here

User avatar
By xtal
#42709 READ the DS18B20 Data pdf
get the raw temp -- MSB LSB
save sign bit MSB hi Bit then logical and MSB,LSB with 7FF = RESULT assuming using 11 bits

if sign bit =1 then Complement result and add 1 = 2's complemented RESULT
now complemented RESULT * .0625 should = negative temperature
else
RESULT = RESULT * .0625 should = positive temperature

You figure out the actual code needed....