#include <LiquidCrystal_I2C.h>
#include "DHT.h"
LiquidCrystal_I2C lcd(0x27, 16, 2); // endereco I2C 0x27, 16 colunas e 2 linhas
int bot = 2;
int dhtP =15;
DHT dht(dhtP, DHT22);
void setup() {
lcd.init(); // inicializa o lcd
lcd.backlight(); //liga a luz de fundo do display
Serial.begin(9600);
dht.begin();
pinMode(bot, INPUT);
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
int botValue = digitalRead(bot);
if(botValue == HIGH){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SEJAM BEM-VINDOS!:");
delay(2000);
lcd.clear();
lcd.setCursor(1, 0);
lcd.print("Temp:");
lcd.print(t);
lcd.print("C");
lcd.setCursor(1, 1);
lcd.print("Hum:");
lcd.print(h);
lcd.print("%");
delay(2000);
} else {
lcd.clear();
}
}