#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>
RTC_DS1307 rtc;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
lcd.backlight();
if(!rtc.begin())
{
Serial.println("Cant find RTC");
while(1);
}
}
void loop()
{
DateTime now = rtc.now();
int hr = now.hour()%12;
if(now.hour()==0)
hr=hr+12;
lcd.print(hr);
Serial.println(hr);
delay(1000);
lcd.clear();
}