Code
[codesyntax lang=”cpp”]
#include <WEMOS_DHT12.h> DHT12 dht12; void setup() { Serial.begin(115200); } void loop() { if(dht12.get()==0){ Serial.print("Temperature in Celsius : "); Serial.println(dht12.cTemp); Serial.print("Temperature in Fahrenheit : "); Serial.println(dht12.fTemp); Serial.print("Relative Humidity : "); Serial.println(dht12.humidity); Serial.println(); } delay(1000); }
[/codesyntax]
Output
Open the serial monitor
Temperature in Celsius : 23.60
Temperature in Fahrenheit : 74.48
Relative Humidity : 38.10
Temperature in Celsius : 23.70
Temperature in Fahrenheit : 74.66
Relative Humidity : 38.30
Temperature in Celsius : 24.00
Temperature in Fahrenheit : 75.20
Relative Humidity : 41.80
Temperature in Celsius : 24.20
Temperature in Fahrenheit : 75.56
Relative Humidity : 42.00
Temperature in Celsius : 24.50
Temperature in Fahrenheit : 76.10
Relative Humidity : 43.20