#include <DHT.h>
#include <DHT_U.h>
#include "DHT.h"
#define DHTPIN 2 // DHT11 located at Pin 2
#define DHTTYPE DHT11 // DHT11 3 Legs Left=GND, Middle=DATA, Right=5V Power.
DHT dht(DHTPIN, DHTTYPE); // Initialize the DHT sensor named dht.
#define DHTPIN 4
#define DHTTYPE DHT11
DHT hot(DHTPIN, DHTTYPE);
#define DHTPIN 8
#define DHTTYPE DHT11
DHT cold(DHTPIN, DHTTYPE);
void setup()
// put your setup code here, to run once:
{
pinMode (7, OUTPUT);
pinMode (10, OUTPUT);
pinMode (12, OUTPUT);
Serial.begin (9600); // Baud rate of monitor or other display.
Serial.println ( "Temperature!" ); // displays the word, Temperature !.
dht.begin(); //Read from the DHT11 sensor labeled dht.
hot.begin();
cold.begin();
}
void loop() {
// put your main code here, to run repeatedly:
delay (1000); // Represents a 5000 milisecond delay
float h = dht.readHumidity ();
float t = dht.readTemperature (); // Read temperature as Celsius (default)
float f = dht.readTemperature (true); // Read temperature as F ( isFahrenheit = true)
float h2 = hot.readHumidity ();
float t2 = hot.readTemperature ();
float f2 = hot.readTemperature (true);
float h3 = cold.readHumidity ();
float t3 = cold.readTemperature ();
float f3 = cold.readTemperature (true);
if (isnan (h) || isnan (t) || isnan(f)) {
Serial.println ( "Failed to read from DHT sensor!");
delay (10000);
}
if (isnan (h2) || isnan (t2) || isnan(f2)) {
Serial.println ( "Failed to read from Hot Chamber sensor!");
delay (10000);
}
if (isnan (h3) || isnan (t3) || isnan(f3)) {
Serial.println ( "Failed to read from Hot Chamber sensor!");
delay (10000);
}
float hif = dht.computeHeatIndex (f, h);
float hic = dht.computeHeatIndex (t, h, false);
Serial.print ( "Fermentor: ");
Serial.print (hif);
Serial.println (" *F");
float hif2 = hot.computeHeatIndex (f, h);
float hic2 = hot.computeHeatIndex (t, h, false);
Serial.print ( "Hot Chamber: ");
Serial.print (hif2);
Serial.println ( " *F ");
float hif3 = cold.computeHeatIndex (f, h);
float hic3 = cold.computeHeatIndex (t, h, false);
Serial.print ( "Cold Chamber: ");
Serial.print (hif3);
Serial.println ( " *F ");
if (hif >60){ // Perameter for turning on and flashing led
digitalWrite (7, HIGH); //LED Flash
delay (300);
digitalWrite (7, LOW);
delay (0); }
if (hif2 >60){ // Perameter for turning on and flashing led
digitalWrite (10, HIGH); //LED Flash
delay (300);
digitalWrite (10, LOW);
delay (0); }
if (hif3 >60){ // Perameter for turning on and flashing led
digitalWrite (12, HIGH); //LED Flash
delay (300);
digitalWrite (12, LOW);
delay (0); }
}
Comments
Please log in or sign up to comment.