#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <RTClib.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 6
#define CS_PIN_UTC 10
#define CS_PIN_LOCAL 9
MD_Parola led_utc = MD_Parola(HARDWARE_TYPE, CS_PIN_UTC, MAX_DEVICES);
MD_Parola led_local = MD_Parola(HARDWARE_TYPE, CS_PIN_LOCAL, MAX_DEVICES);
RTC_DS1307 rtc;
void setup() {
led_utc.begin();
led_utc.setIntensity(0);
led_utc.displayClear();
led_utc.setTextAlignment(PA_CENTER);
led_local.begin();
led_local.setIntensity(0);
led_local.displayClear();
led_local.setTextAlignment(PA_CENTER);
rtc.begin();
}
void loop() {
DateTime now = rtc.now();
// Format UTC time with leading zeros
String utcTime = String(now.hour() - 7) + ":" +
(now.minute() < 10 ? "0" : "") + String(now.minute()) + ":" +
(now.second() < 10 ? "0" : "") + String(now.second()) + "Z";
// Format local time with leading zeros
String localTime = String(now.hour()) + ":" +
(now.minute() < 10 ? "0" : "") + String(now.minute()) + ":" +
(now.second() < 10 ? "0" : "") + String(now.second());
// Display UTC time
led_utc.print(utcTime);
// Display local time
led_local.print(localTime);
delay(100);
}