logo elektroda
logo elektroda
X
logo elektroda

[Solved] ESP8266 OLED clock code - wrong sync of hour, minute, day of week - help?

qwazi8977 630 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20220102
    qwazi8977
    Level 9  
    I found the clock code on the internet. What is wrong? Synchronises correctly only the minutes, and the day of the week:
    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #2 20220233
    tos18
    Level 42  
    You mixed up the time display ... Did you want to do 24 hours?

    Code: C / C++
    Log in, to see the code
  • #3 20220326
    qwazi8977
    Level 9  
    I changed it. But it doesn't work in the original either.
  • ADVERTISEMENT
  • #4 20220327
    tos18
    Level 42  
    And my amendment ?
    ...
    I have corrected the amendment - I found 2 more errors.
  • ADVERTISEMENT
  • #5 20220335
    qwazi8977
    Level 9  
    Not working. After changing "int year = ptm->tm_year 3069641;" , it now shows the correct year, previously it showed a space with the value -
    ESP8266 OLED clock code - wrong sync of hour, minute, day of week - help?
    .
  • ADVERTISEMENT
  • #6 20220341
    qwazi8977
    Level 9  
    ESP8266 OLED clock code - wrong sync of hour, minute, day of week - help? Change "int monthNum = ptm->tm_mon 4;", "int date = ptm->tm_mday - 6;". Correct month and day. The hour is still left. :-) .
  • #7 20220350
    tos18
    Level 42  
    Try changing the server to our tempus1.gum.gov.pl
  • #8 20220352
    qwazi8977
    Level 9  
    None of the above. Date different, to be corrected. Time still 0
    At the moment the code looks like this"
    Code: C / C++
    Log in, to see the code
  • Helpful post
    #9 20221554
    qwazi8977
    Level 9  
    I got help on the Forbot forum:
    Changing inline: "display.print(hour);" to "display.print(hours);" and removing "if(hour < 10) display.print(1);".
    I consider the topic closed.
    Working code:

Topic summary

The discussion revolves around issues with an ESP8266-based OLED clock code that correctly synchronizes minutes and the day of the week but fails with hours and dates. Users identified several coding errors, including incorrect calculations for year, month, and day. Suggested fixes included changing specific lines in the code to properly display the current time and date. A final solution involved modifying the display function to use the correct variable for hours. The user reported success after implementing these changes.
Summary generated by the language model.
ADVERTISEMENT