# ----------------------------------------------- # Code partiel du programme HORLOGE # ----------------------------------------------- # Réglage de l'heure à la mise sous tension time_offset=12*3600+0*60+0 # hh+mm+ss # Routines de service d'interruption (ISR) def handle_interrupt_min(pin): global time_offset time_offset+=60 time.sleep(.2) def handle_interrupt_hr(pin): global time_offset time_offset+=3600 time.sleep(.2) # Réglage des minutes # Ajout de 60s à l'heure initiale button_min = Pin(25, Pin.IN) # Gestionnaire d'interruption button_min.irq(trigger=Pin.IRQ_RISING,handler=handle_interrupt_min) # Réglage des heures # Ajout de 3600s à l'heure initiale button_hr = Pin(26, Pin.IN) # Gestionnaire d'interruption button_hr.irq(trigger=Pin.IRQ_RISING,handler=handle_interrupt_hr) {{ :python:micropython:materiel:thonny.png?nolink&70|}}