#include "RTClib.h"
#include <LiquidCrystal_I2C.h>
RTC_DS1307 rtc;
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
void setup() {
// put your setup code here, to run once:
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
lcd.init();
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(now.hour(), DEC);
lcd.print(":");
lcd.print(now.minute(), DEC);
lcd.print(":");
lcd.print(now.second(), DEC);
delay(1000);
}