Advertisement
ossipee

cooler code1

Aug 13th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.17 KB | None | 0 0
  1.  
  2.  
  3. //ossipee's super cooler code,
  4.  
  5.  
  6.  
  7.  
  8. //add some libraries
  9. #include <DHT.h> //one of many possible DHT22 libs
  10. #include <LiquidCrystal.h> //lcd libs
  11.  
  12. #define DHTPIN 2 //pin that DHT is connected to
  13. #define DHTPIN3 3 //pin that second DHT is connected to
  14. #define DHTTYPE DHT22 //Sensor we are using
  15. #define DHTTYPE3 DHT22 // Second sensor we are using
  16.  
  17.  
  18. DHT dht(DHTPIN, DHTTYPE); //defines location for DHT
  19. DHT dht3(DHTPIN3, DHTTYPE); //defines location for second DHT
  20.  
  21. LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
  22.  
  23. byte fanrelaypin = 4; // call relay fan pin
  24. byte damperrelaypin = 5; //call relay damper pin
  25.  
  26. void setup() {
  27.   // set up the LCD's number of rows and columns:
  28.   lcd.begin(16, 2);
  29.   pinMode(fanrelaypin, OUTPUT);
  30.   digitalWrite(fanrelaypin, LOW);//start with the relay off
  31.   pinMode(damperrelaypin, OUTPUT);
  32.   digitalWrite(damperrelaypin, LOW);//start with the relay off
  33.  
  34.  }
  35.  
  36. void loop() {
  37.  
  38.   //set cursor to column 0, line 0.
  39.   lcd.setCursor(0,0);
  40.   //print Miracle
  41.   lcd.print("Miracle");
  42.   lcd.setCursor(0,1);
  43.   //print Mechanicals
  44.   lcd.print("Mechanicals");
  45.  
  46.   delay(2000);//wait two seconds before taking readings
  47.  
  48.  
  49.   float h = dht.readHumidity(); //defines the variable for humidity
  50.   float t = dht.readTemperature(1); //defines the variable for temperature. (1)converts C to f
  51.  
  52.  
  53.  
  54.   // set the cursor to column 0, line 0
  55.   lcd.setCursor(0,0);
  56.   // print the humidity
  57.   lcd.print("Humidin ");
  58.   lcd.print(h);
  59.   lcd.print(" % ");
  60.   //move line down
  61.   lcd.setCursor(0,1);
  62.   lcd.print("Tempin ");
  63.   lcd.print(t);
  64.   lcd.print(" *F");
  65.  
  66.  
  67.   delay(2000); //wait two sec. before taking another reading.
  68.  
  69.  
  70.  
  71.   float h3 = dht3.readHumidity(); //defines the variable for humidity
  72.   float t3 = dht3.readTemperature(1); //defines the variable for temperature
  73.  
  74.   // set the cursor to column 0, line 0
  75.   lcd.setCursor(0,0);
  76.   // print the humidity
  77.   lcd.print("Humidout ");
  78.   lcd.print(h3);
  79.   lcd.print(" % ");
  80.   //move line down
  81.   lcd.setCursor(0,1);
  82.   lcd.print("Tempout ");
  83.   lcd.print(t3);
  84.   lcd.print(" *F");
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.   delay(2000); //wait two sec. before taking another reading.
  92.  
  93.  
  94.  
  95.  
  96.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement