Great code. Thank you!!! Just testing at 11:45PM and continue to test.It's now 12:04 in the midnight and clock display showing _ _ : _ 4 i.e. all first digits are blank and it just showing 4 minutes past 12 AM. Updates: 20 Sept 2024 Just change line from: display.showNumberDecEx(A, 0b01000000 , false, 4, 0); To: display.showNumberDecEx(A, 0b01000000 , true, 4, 0); //true sets leading zero so now 12:04 (AM) will be shown as 00:04 Complete code: void ShowClock() { timeClient.forceUpdate(); int A, B, x, y; timeClient.update(); // display.setBrightness(4); // Set the brightness: display.setBrightness(0x02); A = timeClient.getHours() * 100 + timeClient.getMinutes(); // Not using x = (timeClient.getHours() > 12) ? (timeClient.getHours() - 12) : (timeClient.getHours()); y = x * 100 + timeClient.getMinutes(); B = timeClient.getSeconds(); //Used to blink colon symbol : (HH and MM seperator) if ((B % 2) == 0) { //display.showNumberDecEx(A, 0b01000000 , false, 4, 0); display.showNumberDecEx(y, 0b01000000, true, 4, 0); //true sets leading zero } else { //display.showNumberDecEx(A, 0b00000000 , false, 4, 0); display.showNumberDecEx(y, 0b00000000, true, 4, 0);//true sets leading zero }
Added two new variables x and y as int with below code: x = (timeClient.getHours() > 12) ? (timeClient.getHours() - 12) : (timeClient.getHours()); y = x * 100 + timeClient.getMinutes(); Then displaying those to have 12 hours clock... Thank you!!!
Amazing 😀
Great code. Thank you!!!
Just testing at 11:45PM and continue to test.It's now 12:04 in the midnight and clock display showing _ _ : _ 4
i.e. all first digits are blank and it just showing 4 minutes past 12 AM.
Updates: 20 Sept 2024
Just change line from:
display.showNumberDecEx(A, 0b01000000 , false, 4, 0);
To:
display.showNumberDecEx(A, 0b01000000 , true, 4, 0); //true sets leading zero so now 12:04 (AM) will be shown as 00:04
Complete code:
void ShowClock() {
timeClient.forceUpdate();
int A, B, x, y;
timeClient.update();
// display.setBrightness(4); // Set the brightness:
display.setBrightness(0x02);
A = timeClient.getHours() * 100 + timeClient.getMinutes(); // Not using
x = (timeClient.getHours() > 12) ? (timeClient.getHours() - 12) : (timeClient.getHours());
y = x * 100 + timeClient.getMinutes();
B = timeClient.getSeconds(); //Used to blink colon symbol : (HH and MM seperator)
if ((B % 2) == 0) {
//display.showNumberDecEx(A, 0b01000000 , false, 4, 0);
display.showNumberDecEx(y, 0b01000000, true, 4, 0); //true sets leading zero
} else {
//display.showNumberDecEx(A, 0b00000000 , false, 4, 0);
display.showNumberDecEx(y, 0b00000000, true, 4, 0);//true sets leading zero
}
Added two new variables x and y as int with below code:
x = (timeClient.getHours() > 12) ? (timeClient.getHours() - 12) : (timeClient.getHours());
y = x * 100 + timeClient.getMinutes();
Then displaying those to have 12 hours clock...
Thank you!!!
Wow sir awesome🙂
can we connect ds3231
dear there is no need to connect DS3231 it update automatically when connected to your internet
@@ImtiazTech bt what when there is power cut n no internet
Wowww
Very interesting
Amazing