#include <dht.h>
#define dataPin 11
dht DHT;
void setup() {
Serial.begin(9600);
}
void loop() {
// READ DATA
int readData = DHT.read22(dataPin);
float t = DHT.temperature; // Gets the values of the temperature
float h = DHT.humidity; // Gets the values of the humidity
Serial.print("La temperatura es: ");
Serial.println(t);
Serial.print("La humedad es: ");
Serial.println(h);
if (t >= 28 && t <= 30) {
Serial.println("La temperatura es ideal para criar pollos");
} else {
Serial.println("Activar los extractores de aire");
}
if (h >= 60 && h <= 70) {
Serial.println("La humedad es ideal para criar pollos");
} else {
Serial.println("Activar los nebulizadores");
}
delay(2000);
}