
DHT Pro Shield is a digital temperature and humidity sensor shield based DHT22.
Features:
The temperature and humidity data read from sensor is the result of the last measurement (the sensor will measure after you read).
To get real-time data, you need read twice.
But not recommended to repeatedly reading sensor, reading interval should be more than 2 seconds.
Technical specs:
Pin:
D1 mini | Shield |
D4 | Data out |
Arduino Code:
File->Sketchbook->libraries->D1_mini_Examples->04.Shields->DHT_Shield
NodeMCU Code:
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.%03drn",
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
Vous aimerez aussi
DHT Pro Shield is a digital temperature and humidity sensor shield based DHT22.