//add the DHT library to the code
#include <dht.h>
//define the constant - pin 8 as the sensorPin
#define sensorPin 8
//create an object to initialize the dht methods from the library
dht weather;
void setup() {
// put your setup code here, to run once:
//establish serial connection
Serial.begin (9600);
}
void loop() {
// put your main code here, to run repeatedly:
//initialize collecting data from the pin
int readData = weather.read22(sensorPin);
//collect and store temperature and humidity
float temp = weather.temperature;
float humid = weather.humidity;
//display temperature readings
Serial.print("Temp: ");
Serial.print(temp);
Serial.println(" C.");
Serial.print("Humidity: ");
Serial.print(humid);
Serial.println(" %");
//add 1 second delay
delay(1000);
}