/*
Basic Parallel LCD Demo with DHT
Shows basic wiring and writing to a parallel LCD module
11/11/2025
*/
#include <LiquidCrystal.h>
#include <dht.h>
// pin constants
const int RS = 12, EN = 11, D4 = 10, D5 = 9, D6 = 8, D7 = 7;
const int DHT_PIN = 13;
// create objects
LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
dht DHT;
void setup() {
// start serial
Serial.begin(9600);
// start LCD
lcd.begin(16, 2);
// print a splash on the LCD
lcd.setCursor(4, 0);
lcd.print("DHT Demo");
lcd.setCursor(6, 1);
lcd.print("V1.0");
delay(2000);
lcd.clear();
// print headers
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.setCursor(0, 1);
lcd.print("Humidity:");
}
void loop() {
char dataBuff[8];
int chk = DHT.read22(DHT_PIN);
Serial.print(DHT.temperature, 1);
Serial.print("\t");
Serial.println(DHT.humidity, 1);
snprintf(dataBuff, 8, "%4d %cC", (int)DHT.temperature, char(223));
lcd.setCursor(9, 0);
lcd.print(dataBuff);
snprintf(dataBuff, 8, "%4d %%", (int)DHT.humidity);
lcd.setCursor(9, 1);
lcd.print(dataBuff);
delay(2000);
}