Post your best Lua script examples here

User avatar
By bakicc
#12407
chadouming wrote:
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.


Thanks, going to try this!
Does this also works for the humidity?
User avatar
By chadouming
#12410
bakicc wrote:
chadouming wrote:
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.


Thanks, going to try this!
Does this also works for the humidity?


yes
User avatar
By rutierut
#12419
bakicc wrote:
rutierut wrote:I will upload a code to control RGB leds tomorrow or maybe monday.


Cool! Looking forward to it :)

Which ESP chip version do you recommend?


Definitely the esp-12, it's easy to make it breadboard friendly , costs the same as an esp-01 and has all the io's broken out.

As for the other question regarding humidity, I'll finish that script too, I'll upload the finished version tomorrow.