#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
RTC_DS1307 rtc;
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
// put your setup code here, to run once:
rtc.begin();
lcd.init();
lcd.backlight();
Serial.begin(9600);
lcd.begin(20, 4);
lcd.setCursor(0, 0);
lcd.print("Real Time Clock(RTC)");
delay(2000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
lcd.print("Time: ");
lcd.print(now.hour());
lcd.print(":");
lcd.print(now.minute());
lcd.print(":");
lcd.print(now.second());
delay(1000);
lcd.clear();
}