/* Please Support Us On: https://global-prog.com */ #include // Include DHT library. #define DHT_TYPE DHT22 // DHT22 SENSOR TYPE #define DHT_PIN 3 // IN THIS LINE WE DEFINE THE DHT PIN = 3 DHT DHT_SENSOR (DHT_PIN,DHT_TYPE); float Humidity = 0; // Initial the humidity container variable float Temp_C = 0; // Initial the Temperature Celsius float Temp_F = 0; // Initial the Temperature Fahrenheit void setup() { Serial.begin(9600); // Begin the serial monitor with baud rate of 9600 DHT_SENSOR.begin(); // Prepare the DHT sensor to measure the temperature and humidity delay(1000); // Wait for 1 Second } void loop() { Humidity = DHT_SENSOR.readHumidity(); // Read the Humidity from the sensor delay(1000); // Wait for 1 Second Temp_C = DHT_SENSOR.readTemperature(); // Read Temperature in Celsius Temp_F = DHT_SENSOR.readTemperature(true); // Read Temperature in Fahrenheit Serial.println("Temerature In ℃ = "); Serial.println(Temp_C); Serial.println("\nTemerature In ℉ = "); Serial.println(Temp_F); Serial.println("\nHumidity = "); Serial.println(Humidity); Serial.println("\n"); }