Hi,
I'm trying to show time and date on LCD, then show temperature and humidity, and repate.
I tried to use "lcd.clear()" but it won't work.
Here's my code
#include <dht.h>
#include <DS3231.h>
#include <LiquidCrystal.h>
DS3231 rtc(SDA, SCL);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
#define DHT11_PIN A0
void setup() {
rtc.begin();
lcd.begin(16, 2);
}
void loop() {
lcd.setCursor(0, 0);
lcd.print("Time: ");
lcd.print(rtc.getTimeStr());
lcd.setCursor(0, 1);
lcd.print("Date: ");
lcd.print(rtc.getDateStr());
delay(1000);
lcd.clear();
delay(500);
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0, 0);
lcd.print("Temp.= ");
lcd.print(DHT.temperature, 0);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity= ");
lcd.print(DHT.humidity, 0);
lcd.print("%");
delay(5000);
}