Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ossipee's super cooler code,
- //add some libraries
- #include <DHT.h> //one of many possible DHT22 libs
- #include <LiquidCrystal.h> //lcd libs
- #define DHTPIN 2 //pin that DHT is connected to
- #define DHTPIN3 3 //pin that second DHT is connected to
- #define DHTTYPE DHT22 //Sensor we are using
- #define DHTTYPE3 DHT22 // Second sensor we are using
- #define f insideTemp //speariment
- #define h insideHumid //
- #define f3 outsideTemp //
- #define h3 outsideHumid //
- int insideTemp = f;
- unsigned int insideHumid = h;
- int outsideTemp = f3 ;
- unsigned int outsideHumid = h3;
- DHT dht(DHTPIN, DHTTYPE); //defines location for DHT
- DHT dht3(DHTPIN3, DHTTYPE); //defines location for second DHT
- LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
- byte fanrelaypin = 4; // call relay fan pin
- byte damperrelaypin = 5; //call relay damper pin
- void setup() {
- // set up the LCD's number of rows and columns:
- lcd.begin(16, 2);
- pinMode(fanrelaypin, OUTPUT);
- digitalWrite(fanrelaypin, LOW);//start with the relay off
- pinMode(damperrelaypin, OUTPUT);
- digitalWrite(damperrelaypin, LOW);//start with the relay off
- }
- void loop() {
- //set cursor to column 0, line 0.
- lcd.setCursor(0,0);
- //print Miracle
- lcd.print("Miracle");
- lcd.setCursor(0,1);
- //print Mechanicals
- lcd.print("Mechanicals");
- delay(2000);//wait two seconds before taking readings
- float h = dht.readHumidity(); //defines the variable for humidity
- float t = dht.readTemperature(1); //defines the variable for temperature. (1)converts C to f
- // set the cursor to column 0, line 0
- lcd.setCursor(0,0);
- // print the humidity
- lcd.print("Humidin ");
- lcd.print(h);
- lcd.print(" % ");
- //move line down
- lcd.setCursor(0,1);
- lcd.print("Tempin ");
- lcd.print(t);
- lcd.print(" *F");
- delay(2000); //wait two sec. before taking another reading.
- float h3 = dht3.readHumidity(); //defines the variable for humidity
- float t3 = dht3.readTemperature(1); //defines the variable for temperature
- // set the cursor to column 0, line 0
- lcd.setCursor(0,0);
- // print the humidity
- lcd.print("Humidout ");
- lcd.print(h3);
- lcd.print(" % ");
- //move line down
- lcd.setCursor(0,1);
- lcd.print("Tempout ");
- lcd.print(t3);
- lcd.print(" *F");
- if(f < 30 + f3 > 35) // if outside temp less than 30f and cooler warmer than 35f
- {
- digitalWrite(damperrelaypin, HIGH); // open exhaust damper
- digitalWrite(fanrelaypin, HIGH); // turn on outside supply air fan
- }
- else
- {
- digitalWrite(fanrelaypin, LOW);
- digitalWrite(damperrelaypin, LOW);
- }
- delay(2000); //wait two sec. before taking another reading.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement