#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 21, 22);
void setup() {
Serial.begin(112500);
lcd.init();
lcd.backlight();
}
void loop() {
lcd.clear();
unsigned long activeTime = 4205000; // Obtain the time in milliseconds
unsigned long seconds = activeTime / 1000; // Convert milliseconds to seconds
unsigned long minutes = seconds / 60; // Calculate total minutes
unsigned long hours = minutes / 60; // Calculate total hours
unsigned long days = hours / 24; // Calculate total days
hours %= 24;
minutes %= 60;
lcd.setCursor(0, 1);
lcd.print("Active: ");
if (days > 0) {
lcd.print(days);
lcd.print(":");
}
if (hours < 10) {
lcd.print("0");
}
lcd.print(hours);
lcd.print(":");
if (minutes < 10) {
lcd.print("0");
}
lcd.print(minutes);
if (days <= 0) {
seconds %= 60;
lcd.print(":");
if (seconds < 10) {
lcd.print("0");
}
lcd.print(seconds);
}
delay(100000000);
}