Prac 11
Prac 11
h>
#include <DHT.h>
#define outPin 12 // Pin to which the sensor is connected
#define DHTTYPE DHT11
void setup() {
Serial.begin(9600);
Serial.println("Working properly !");
dht.begin();
}
void loop() {
delay(2000);
float c = dht.readTemperature();
if (isnan(c)) {
Serial.println("Failed to read temperature from the sensor!");
return;
}
if (c > maxTemp) {
maxTemp = c;
}
if (c < minTemp) {
minTemp = c;
}
Serial.print("Temperature: ");
Serial.print(c);
Serial.println(" °C");
delay(2000);
float f = dht.readTemperature(true);
if (isnan(f))
{
Serial.println("Not Working !");
}