From 456d95eff64f6e5455c8f4a7851ee0be7bce2120 Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 18 Jan 2026 18:38:03 -0500 Subject: [PATCH] Delete clock.ino --- clock.ino | 57 ------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 clock.ino diff --git a/clock.ino b/clock.ino deleted file mode 100644 index 1071926..0000000 --- a/clock.ino +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include -#include -#include - -RTC_DS1307 rtc; - -#define TIME_X 5 -#define TIME_Y 70 -#define TIME_SIZE 10 - -void setup() { - TFT_BL_ON; - Tft.TFTinit(); - Wire.begin(); - rtc.begin(); - - // Uncomment to set RTC to compile time (do once, then comment out) - // rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); - - // Clear entire screen once - Tft.fillScreen(0, 320, 0, 240, BLACK); -} - -void loop() { - static unsigned long lastUpdate = 0; - static char lastTime[16] = ""; - - if (millis() - lastUpdate >= 1000) { - lastUpdate = millis(); - - DateTime now = rtc.now(); - - // Convert to 12-hour format - int hour12 = now.hour(); - if (hour12 == 0) { - hour12 = 12; // Midnight is 12 AM - } else if (hour12 > 12) { - hour12 -= 12; // Convert PM hours - } - - char timebuf[16]; - sprintf(timebuf, "%02d:%02d", hour12, now.minute()); - - // Update time if changed - if (strcmp(timebuf, lastTime) != 0) { - // Erase old time by drawing in BLACK - Tft.drawString(lastTime, TIME_X, TIME_Y, TIME_SIZE, BLACK, LANDSCAPE); - - // Draw new time in WHITE - Tft.drawString(timebuf, TIME_X, TIME_Y, TIME_SIZE, WHITE, LANDSCAPE); - - strcpy(lastTime, timebuf); - } - } -} \ No newline at end of file