#include "DHT.h"
#define DHTPIN 15
#define DHTType DHT11
DHT dht(DHTPIN,DHTType);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("this is dht sensor");
dht.begin();
}
void loop() {
// put your main code here, to run repeatedly:
float h = dht.readHumidity();
float t = dht.readTemperature();
if(isnan(h)|| isnan(t)){
Serial.println("Failed to read from dht sensor.");
return;
}
Serial.println("Humidity: ");
Serial.print(h);
Serial.println("Temperature");
Serial.print(t);
delay(2000); // this speeds up the simulation
}