#include <ThreeWire.h>
#include <RtcDS1302.h>
#include <LiquidCrystal_I2C.h>
ThreeWire myWire(10, 9,8 ); // IO, SCLK, CE
RtcDS1302<ThreeWire> Rtc(myWire);
LiquidCrystal_I2C lcd_27(0x27, 16, 2);
//bool rtclock_err;
void setup ()
{
Serial.begin(9600);
Rtc.Begin();
lcd_27.init ();
lcd_27.backlight();
RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
Rtc.SetDateTime(compiled + 0 * 8 * 60 * 60);
//Rtc.SetDateTime(RtcDateTime(2026, 1, 3, 17, 9, 00));
}
void loop() {
static char date[11];
static char time[9];
RtcDateTime dt = Rtc.GetDateTime();
snprintf(date, 11, "%04u-%02u-%02u", dt.Year(), dt.Month(), dt.Day());
snprintf(time, 9, "%02d:%02d:%02d", dt.Hour(), dt.Minute(), dt.Second());
Serial.print(date);
Serial.print(" ");
Serial.print(time);
Serial.println("");
delay(300);
}