#include "DHT.h"
#include "LiquidCrystal.h"
#define DHTPIN 2
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
Serial.begin(115200);
Serial.println(F("DHT22 example!"));
lcd.begin(16, 2);
// Agora você pode interagir com o LCD, por exemplo:
lcd.print("Ola Mundo!");
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
// Check if any reads failed and exit early (to try again).
if (isnan(temperature) || isnan(humidity)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
lcd.begin(16, 2);
// Agora você pode interagir com o LCD, por exemplo:
lcd.print("Ola Mundo!");
Serial.print(F("Humidity: "));
Serial.print(humidity);
Serial.print(F("% Temperature: "));
Serial.print(temperature);
Serial.println(F("°C "));
// Wait a few seconds between measurements.
delay(2000);
}