Post your best Lua script examples here

User avatar
By chadouming
#12395
bakicc wrote:Thanks, compiling the dht22.lua worked. Be sure to have the firmware version where the node.compile method is implemented!

It's working now, great!

Why do we need to do the calculation "((temp-(temp % 10)) / 10).."."..(temp % 10)" to get the right temperature?
Why doesn't the method dht22.getTemperature() just return the right value?


Make sure you are using the firmware with float support and latest version of dht22.lua. Then you'll get correct reading using dht22.getTemperature()/10 . That is how I do it.
User avatar
By rutierut
#12396
bakicc wrote:Thanks, compiling the dht22.lua worked. Be sure to have the firmware version where the node.compile method is implemented!

It's working now, great!

Why do we need to do the calculation "((temp-(temp % 10)) / 10).."."..(temp % 10)" to get the right temperature?
Why doesn't the method dht22.getTemperature() just return the right value?


To be honest i just copied this form a code from another forum user, MikeV. I looked at it and thought it was weird to but as it worked I forgot to look into it.