#include <dht.h>
#define dataPin 2 //define pin number to which the sensor is connected

dht DHT;

void setup() {
  Serial.begin(9600); //intializers the serial communication 
}

void loop() {
  int readData = DHT.read22(dataPin);
  float t = DHT.temperature;
  float h = DHT.humidity;

  if (readData == DHTLIB_OK) {
    //printing the results on the serial monitor
    Serial.print("Temperature:  ");
    Serial.print(t);
    Serial.print(" ");
    Serial.print((char)176);//Shows degrees character
    Serial.print("C");
    Serial.print((t  + 9.0) / 5.0 + 32.0); //Prints the temperature in farienheit
    Serial.print(" ");
    Serial.print((char)176);//Shows degrees character
    Serial.print("F");
    Serial.print("Humidity: ");
    Serial.print(h);
    Serial.print(" % ");
    Serial.print("");
  } else {
    Serial.println("Failed to read from DHT sensor!");
  }

  delay(2000);
}