#include <TinyWireM.h>
#include <TinyRTClib.h>
#include <TinyLiquidCrystal_I2C.h>
TinyRTC rtc;
TinyLiquidCrystal_I2C lcd(0); // Use TinyWireM's default address (0)
void setup() {
lcd.begin(16, 2);
lcd.backlight();
TinyWireM.begin();
rtc.begin();
}
void loop() {
DateTime now = rtc.now();
int year = now.year();
int month = now.month();
int day = now.day();
int hours = now.hour();
int minutes = now.minute();
int seconds = now.second();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Time: ");
if (hours < 10) lcd.print("0");
lcd.print(hours);
lcd.print(":");
if (minutes < 10) lcd.print("0");
lcd.print(minutes);
lcd.print(":");
if (seconds < 10) lcd.print("0");
lcd.print(seconds);
delay(1000); // Update the time every second
}