Skip to content
Discussion options

You must be logged in to vote

or it could be something like:

current_hour = time.localtime()[3]
while True:
    t = time.localtime()
    hrs.value(hstart * uv(-t[3]*pi/6 - t[4]*pi/360), YELLOW)
    mins.value(mstart * uv(-t[4] * pi/30), YELLOW)
    secs.value(sstart * uv(-t[5] * pi/30), RED)
    dial.text('{} {} {}'.format(days[t[6]], t[2], months[t[1] - 1]))
    refresh(ssd)
   
    hh = t[3]

    if hh != current_hour:
        if hh == 0:
            my_first_function()
        elif hh == 14:
            my_second_function()
        else:
            my_third_function()

    current_hour = hh

    time.sleep(1)

The check for mm and ss is not needed, since current_hour != hh is only valid at the start of an hour.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@robert-hh
Comment options

Answer selected by jsa91
@jsa91
Comment options

Comment options

You must be logged in to vote
1 reply
@jsa91
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
ESP32
Labels
None yet
3 participants