DHT Pro Shield is a digital temperature and humidity sensor shield based DHT22
Features:
Temperature: -40~80°C (±0.5°C)
Humidity: 0-99.9%RH (±2%RH)
Pins:
D1 mini | Shield |
D4 | Data out |
Arduino Code
Install DHT sensor library
Test Code
NodeMCU Code Example:
pin = 4
status, temp, humi, temp_dec, humi_dec = dht.read(pin)
if status == dht.OK then
— Integer firmware using this example
print(string.format(«DHT Temperature:%d.%03d;Humidity:%d.%03d\r\n»,
math.floor(temp),
temp_dec,
math.floor(humi),
humi_dec
))– Float firmware using this example
print(«DHT Temperature:»..temp..»;»..»Humidity:»..humi)elseif status == dht.ERROR_CHECKSUM then
print( «DHT Checksum error.» )
elseif status == dht.ERROR_TIMEOUT then
print( «DHT timed out.» )
end
status, temp, humi, temp_dec, humi_dec = dht.read(pin)
if status == dht.OK then
— Integer firmware using this example
print(string.format(«DHT Temperature:%d.%03d;Humidity:%d.%03d\r\n»,
math.floor(temp),
temp_dec,
math.floor(humi),
humi_dec
))– Float firmware using this example
print(«DHT Temperature:»..temp..»;»..»Humidity:»..humi)elseif status == dht.ERROR_CHECKSUM then
print( «DHT Checksum error.» )
elseif status == dht.ERROR_TIMEOUT then
print( «DHT timed out.» )
end
Debe estar conectado para enviar un comentario.