I created word rtc in 2022 and the time has lagged behind, I need help updating the time to AEST. Someone helped write the code so not sure how to update the code myself.
Can someone please help me find the code used to change the time or on what to replace the current code with? Thanks
Here's the full code:
#include <FastLED.h>
#include <DS3231.h>
#define NUM_LEDS 110
#define DATA_PIN 8
DS3231 rtc(SDA, SCL);
CRGB leds[NUM_LEDS];
// Init a Time-data structure
Time t;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 50);
// Setup Serial connection
Serial.begin(115200);
// Initialize the rtc object
rtc.begin();
// randomSeed(analogRead(0));
//rtc.adjust(DateTime(F(__DATE__),F(__TIME__)));
//rtc.adjust(DateTime(2023, 12, 28, 10, 57, 0));
}
void loop() {
displayTime();
}
void displayTime() {
FastLED.clear();
// Get data from the DS3231
t = rtc.getTime();
int minute = t.min;
//int minute = 36;
int hour = t.hour;
if (hour >= 12) {
displayPM();
} else {
displayAM();
}
hour = hour % 12;
Serial.println(hour);
Serial.println(minute);
//int hour = 1;
if (hour == 0) {
hour = 1;
}
displayIT();
displayIS();
// now we display the appropriate minute counter
if ((minute > 4) && (minute < 10)) {
displayFIVE();
displayPAST();
Serial.print("Five Minutes ");
}
if ((minute > 9) && (minute < 15)) {
displayTEN();
displayPAST();
Serial.print("Ten Minutes ");
}
if ((minute > 14) && (minute < 20)) {
displayQUARTER();
displayPAST();
Serial.print("Quarter ");
}
if ((minute > 19) && (minute < 25)) {
displayTWENTY();
displayPAST();
Serial.print("Twenty Minutes ");
}
if ((minute > 24) && (minute < 30)) {
displayTWENTY();
displayFIVE();
displayPAST();
Serial.print("Twenty Five Minutes ");
}
if ((minute > 29) && (minute < 35)) {
displayHALF();
displayPAST();
Serial.print("Half ");
}
if ((minute > 34) && (minute < 40)) {
displayTWENTY();
displayFIVE();
displayTO();
Serial.print("Twenty Five Minutes ");
}
if ((minute > 39) && (minute < 45)) {
displayTWENTY();
displayTO();
Serial.print("Twenty Minutes ");
}
if ((minute > 44) && (minute < 50)) {
displayQUARTER();
displayTO();
Serial.print("Quarter ");
}
if ((minute > 49) && (minute < 55)) {
displayTEN();
displayTO();
Serial.print("Ten Minutes ");
}
if (minute > 54) {
displayFIVE();
displayTO();
Serial.print("Five Minutes ");
}
if (minute < 5) {
Serial.println(hour);
switch (hour) {
case 1:
displayONE();
break;
case 2:
displayTWO();
break;
case 3:
displayTHREE();
break;
case 4:
displayFOUR();
break;
case 5:
displayFIVE();
break;
case 6:
displaySIX();
break;
case 7:
displaySEVEN();
break;
case 8:
displayEIGHT();
break;
case 9:
displayNINE();
break;
case 10:
displayTEN();
break;
case 11:
displayELEVEN();
break;
case 12:
displayTWELVE();
break;
}
displayOCLOCK();
} else if ((minute < 35) && (minute > 4)) {
switch (hour) {
case 1:
displayONE();
break;
case 2:
displayTWO();
break;
case 3:
displayTHREE();
break;
case 4:
displayFOUR();
break;
case 5:
displayFIVE2();
break;
case 6:
displaySIX();
break;
case 7:
displaySEVEN();
break;
case 8:
displayEIGHT();
break;
case 9:
displayNINE();
break;
case 10:
displayTEN();
break;
case 11:
displayELEVEN();
break;
case 12:
displayTWELVE();
break;
}
} else {
switch (hour) {
case 1:
displayTWO();
break;
case 2:
displayTHREE();
break;
case 3:
displayFOUR();
break;
case 4:
displayFIVE2();
break;
case 5:
displaySIX();
break;
case 6:
displaySEVEN();
break;
case 7:
displayEIGHT();
break;
case 8:
displayNINE();
break;
case 9:
displayTEN();
break;
case 10:
displayELEVEN();
break;
case 11:
displayTWELVE();
break;
case 12:
displayONE();
break;
}
}
delay(60000);
long randNumber = random(720);
if (randNumber == 15) {
displayILVU();
delay(60000);
}
}
void testAll() {
int del = 200;
displayIT();
delay(del);
FastLED.clear();
displayIS();
delay(del);
FastLED.clear();
displayAM();
delay(del);
FastLED.clear();
displayPM();
delay(del);
FastLED.clear();
displayQUARTER();
delay(del);
FastLED.clear();
displayTWENTY();
delay(del);
FastLED.clear();
displayILVU();
delay(del);
FastLED.clear();
displayFIVE();
delay(del);
FastLED.clear();
displayHALF();
delay(del);
FastLED.clear();
displayTO();
delay(del);
FastLED.clear();
displayTEN();
delay(del);
FastLED.clear();
displayPAST();
delay(del);
FastLED.clear();
displayNINE();
delay(del);
FastLED.clear();
displayONE();
delay(del);
FastLED.clear();
displaySIX();
delay(del);
FastLED.clear();
displayTHREE();
delay(del);
FastLED.clear();
displayFOUR();
delay(del);
FastLED.clear();
displayFIVE2();
delay(del);
FastLED.clear();
displayTWO();
delay(del);
FastLED.clear();
displayEIGHT();
delay(del);
FastLED.clear();
displayELEVEN();
delay(del);
FastLED.clear();
displaySEVEN();
delay(del);
FastLED.clear();
displayTWELVE();
delay(del);
FastLED.clear();
displayTEN2();
delay(del);
FastLED.clear();
displayOCLOCK();
delay(del);
FastLED.clear();
}
void displayIT() {
for (int i = 108; i <= 109; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayIS() {
for (int i = 105; i <= 106; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayAM() {
for (int i = 101; i <= 102; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayPM() {
for (int i = 99; i <= 100; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayQUARTER() {
for (int i = 90; i <= 96; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTWENTY() {
for (int i = 82; i <= 87; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayILVU() {
leds[70] = CRGB(0, 100, 80);
for (int i = 59; i <= 61; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayFIVE() {
for (int i = 78; i <= 81; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayHALF() {
for (int i = 66; i <= 69; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTEN2() {
for (int i = 71; i <= 73; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTO() {
for (int i = 75; i <= 76; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayPAST() {
for (int i = 62; i <= 65; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayNINE() {
for (int i = 55; i <= 58; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayONE() {
for (int i = 44; i <= 46; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displaySIX() {
for (int i = 47; i <= 49; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTHREE() {
for (int i = 50; i <= 54; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayFOUR() {
for (int i = 40; i <= 43; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayFIVE2() {
for (int i = 36; i <= 39; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTWO() {
for (int i = 33; i <= 35; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayEIGHT() {
for (int i = 22; i <= 26; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayELEVEN() {
for (int i = 27; i <= 32; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displaySEVEN() {
for (int i = 17; i <= 21; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTWELVE() {
for (int i = 11; i <= 16; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayTEN() {
for (int i = 0; i <= 2; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}
void displayOCLOCK() {
for (int i = 5; i <= 10; i++) {
leds[i] = CRGB(0, 100, 80);
}
FastLED.show();
}