#include <dht.h>
#define dataPin 8 // Defines pin number to which the sensor is connected
dht Sensor; // create an object named Sensor to access the functions in dht li
void setup()
{
Serial.begin(9600); //establish serial connection
7
void loop()
{
int readData = Sensor.read22 (dataPin);// initialize the collection of readi
float t = Sensor.temperature; // Gets the values of the temperature and stor
float h = Sensor.humidity;// Gets the values of the humidity & store it in
/ Printing the results on the serial monitor
Serial.print ("Temperature
=
");
serial.print(t);
Serial.printin(" C");
Serial.print ("Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);// Delays 2 seconds