//include header file
#include <DHT.h>
//set the DHT type
#define DHTTYPE DHT22
//set dht pin
int DHTpin=2;
int red=5;
//DHT object
DHT dht(DHTpin, DHTTYPE);
void setup()
{
//ready the arduino board for data exchange
Serial.begin(9600);
//initialsie the dht sensor
dht.begin();
}
void loop()
{
delay(10000);
//get the humidity
float humi=dht.readHumidity();
//get the temperature
float temp=dht.readTemperature();
//display output
Serial.println("Humidity in %:");
Serial.println(humi);
// display temperature output
Serial.println("temperature in C:");
Serial.println(temp);
}