You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.
I am using dht22_min.lua together with a small script for measuring temperature and humidity. My script is:
-- set up some DHT22 things from https://github.com/javieryanez/nodemcu-modules/tree/master/dht22
PIN = 4 -- data pin, GPIO2
dht22 = require("dht22_min")
chipserial = node.chipid()
-- run the server
dht22.read(PIN)
t = dht22.getTemperature()
h = dht22.getHumidity()
tdht22 = (t / 10).."."..(t % 10)
hdht22 = (h / 10).."."..(h % 10)
print("Temperature: "..tdht22.." C")
print("Humidity: "..hdht22.." %")
I am getting a nil value for humidity ( "attempt to perform arithmetic on global 'h' (a nil value)") some times, some times I get wrong values (about 11 deg and 25 % humidity, real temperature is about 24 deg actually).
What should I change to get correct values and to get values every time the script runs?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I am using dht22_min.lua together with a small script for measuring temperature and humidity. My script is:
I am getting a nil value for humidity ( "attempt to perform arithmetic on global 'h' (a nil value)") some times, some times I get wrong values (about 11 deg and 25 % humidity, real temperature is about 24 deg actually).
What should I change to get correct values and to get values every time the script runs?
The text was updated successfully, but these errors were encountered: