Added lua test program for dht module.

This commit is contained in:
Pat Wood 2015-06-26 10:52:47 -04:00
parent 1e7641bcb8
commit d12242d108
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
local PIN = 4
local t, h = dht.read22(PIN)
if h == nil then
print("Error reading from DHT11/22")
else
-- temperature in Farenheit
local temp = (9 * t / 50 + 32)
print("Temperature: "..temp.." deg F")
-- humidity
local hum = h / 10
print("Humidity: "..hum.."%")
--print(temp, hum)
end