Re: Port DHT11 library to Lua ?
Posted: Mon Jan 05, 2015 1:08 pm
Thanks Pigs Fly!
I tested the DHT11 code and it works fine!
Temperature: 23.0
Humidity: 65.0
ChecksumReceived: 88
ChecksumTest: 88
> dofile('dht11.lua')
Since FP math can't be done, does anyone know a bit trick to convert C to F? I tried:
tF = (Temperature* 9/5) + 32
print ("TempF: "..tF)
TempC: 23.0
TempF: 73
Humidity: 67.0
ChecksumReceived: 90
ChecksumTest: 90
but the fraction gets cut off. I know the DHT11 only has 1C resolution, but it would be nice to display it correctly.
Many Thanks!
I tested the DHT11 code and it works fine!
Temperature: 23.0
Humidity: 65.0
ChecksumReceived: 88
ChecksumTest: 88
> dofile('dht11.lua')
Since FP math can't be done, does anyone know a bit trick to convert C to F? I tried:
tF = (Temperature* 9/5) + 32
print ("TempF: "..tF)
TempC: 23.0
TempF: 73
Humidity: 67.0
ChecksumReceived: 90
ChecksumTest: 90
but the fraction gets cut off. I know the DHT11 only has 1C resolution, but it would be nice to display it correctly.
Many Thanks!