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 DHTPIN3 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(DHTPIN3, 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(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");
- delay(2000); //wait two sec. before taking another reading.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement