#include //DHT and LCD libraries #include #define I2C_ADDR 0x27 #define BACKLIGHT_PIN 3 #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); dht DHT; //Declaring the DHT as a dht type to use it later #define DHT11_PIN 4 //Declaring where the DHT signal pin is wired void setup(){ lcd.begin (16,2); lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); } void loop() { lcd.clear(); lcd.setCursor(0,0); int chk = DHT.read11(DHT11_PIN); //Reading data from the module lcd.print("Temp: "); lcd.print(DHT.temperature); //Showing temperature value (before that you can do some math to get the temperature in Farnheit) lcd.print(" C"); lcd.setCursor(0,1); lcd.print("Humidity: "); lcd.println(DHT.humidity); //Showing humidity percentage lcd.print(" %"); delay(3000); //Refreshing every 1s }