Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DHT.h" //includes lib for the humdity sensor
- #include <LiquidCrystal.h> //lcd lib
- #define DHTPIN 2 //pin that DHT is connected to
- #define DHTPIN 3 //pin that second DHT is connected to
- #define DHTTYPE DHT22 //Sensor we are using
- #define DHTTYPE3 DHT22 // Second sensor we are using
- DHT dht(DHTPIN, DHTTYPE); //defines location for DHT
- DHT dht3(DHTPIN, DHTTYPE); //defines location for second DHT
- LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
- void setup() {
- // set up the LCD's number of rows and columns:
- lcd.begin(16, 2);
- }
- void loop() {
- float h = dht.readHumidity(); //defines the variable for humidity
- float t = dht.readTemperature(); //defines the variable for temperature
- float f = (t * 9.0)/5.0 + 32.0;
- // set the cursor to column 0, line 0
- lcd.setCursor(0,0);
- // print the humidity
- lcd.print("Humidity ");
- lcd.print(h);
- lcd.print(" % ");
- //move line down
- lcd.setCursor(0,1);
- lcd.print("Temp ");
- lcd.print(f);
- 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(); //defines the variable for temperature
- float f3 = (t3 * 9.0)/5.0 + 32.0;
- // set the cursor to column 0, line 0
- lcd.setCursor(0,0);
- // print the humidity
- lcd.print("Humidity ");
- lcd.print(h3);
- lcd.print(" % ");
- //move line down
- lcd.setCursor(0,1);
- lcd.print("Temp ");
- lcd.print(f3);
- lcd.print(" *F");
- delay(2000); //wait two sec. before taking another reading.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement