#include <LiquidCrystal.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
//Pin 12: RS (Register Select) pin of the LCD
//Pin 11: Enable pin of the LCD
//Pin 5: D4 pin of the LCD
//Pin 4: D5 pin of the LCD
//Pin 6: D6 pin of the LCD
//Pin 7: D7 pin of the LCD
LiquidCrystal lcd(12, 11, 5, 4, 6, 7);
void setup() {
lcd.begin(16, 2);
dht.begin();
}
void loop() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(dht.readTemperature());
lcd.print(" C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(dht.readHumidity());
lcd.print("%");
delay(2000);
}