// LCD1602 to Arduino Uno connection example
#include <LiquidCrystal.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
#define pi 3.14
float h = 0;
float t = 0;
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
Serial.begin(115200);
}
void loop() {
dht.begin();
h = dht.readHumidity();
t = dht.readTemperature();
lcd.setCursor(0,0);
lcd.print("H% ");
lcd.print(h);
lcd.setCursor(8,0);
lcd.print("Temp ");
lcd.print(t);
delay(500);
lcd.clear();
}
// lcd.begin(16, 2);
// you can now interact with the LCD, e.g.:
// lcd.print("Hello ");
// delay(500);
// lcd.print("test");
// delay(1000);
// lcd.clear();
// delay(500);