Skip to main content
ksale.1
Senior II
November 22, 2025
Solved

Clock Example wil not update to current time

  • November 22, 2025
  • 1 reply
  • 155 views

In the setupscreen function:

Screen1ViewBase::setupScreen();

 digitalHours = digitalClock1.getCurrentHour();
	digitalMinutes = digitalClock1.getCurrentMinute();
	digitalSeconds = digitalClock1.getCurrentSecond();

and in the handletickevent

Screen1View::tickCounter++;

 if (tickCounter % 60 == 0)
 {
 if (++digitalSeconds >= 60)
 {
 digitalSeconds = 0;
 if (++digitalMinutes >= 60)
 {
 digitalMinutes = 0;
 if (++digitalHours >= 24)
 {
 digitalHours = 0;
 }
 }
 }

 // Update the clocks
 digitalClock1.setTime24Hour(digitalHours, digitalMinutes, digitalSeconds);

But as shown below the time is the initial value (current time was 22:47)  how can we fix it.clock.png

Best answer by ksale.1

I found the answer in this st tutorial video in the link:

https://www.youtube.com/watch?v=dx7xHRH9YXg&t=69s 

1 reply

ksale.1
ksale.1AuthorBest answer
Senior II
November 23, 2025

I found the answer in this st tutorial video in the link:

https://www.youtube.com/watch?v=dx7xHRH9YXg&t=69s