FIX : possible pb de partage d'infos entre les butons

This commit is contained in:
Raymond Bourges 2026-01-19 18:52:52 +01:00
parent e719b6058c
commit b6a6c844bc

View File

@ -14,14 +14,14 @@ def debug(str):
class Bouton: class Bouton:
DEBOUNCE_MS = 500 DEBOUNCE_MS = 500
dernier_appui = 0
on = False
def __init__(self, nom, pin, todo = None, pin_led = None, led_on = False): def __init__(self, nom, pin, todo = None, pin_led = None, led_on = False):
self.nom = nom self.nom = nom
self.pin = Pin(pin, Pin.IN, Pin.PULL_UP) self.pin = Pin(pin, Pin.IN, Pin.PULL_UP)
self.pin.irq(trigger = Pin.IRQ_FALLING, handler = self.bouton_presse) self.pin.irq(trigger = Pin.IRQ_FALLING, handler = self.bouton_presse)
self.todo = todo self.todo = todo
self.dernier_appui = 0
self.on = False
if pin_led is None: if pin_led is None:
self.avec_led = False self.avec_led = False
else: else:
@ -183,7 +183,7 @@ def action_rouge():
bouton_rouge.led_on() bouton_rouge.led_on()
consigne = 80 consigne = 80
bouton_rouge = Bouton("bleu", Broche[10], action_rouge, Broche[9]) bouton_rouge = Bouton("rouge", Broche[10], action_rouge, Broche[9])
def action_moins(): def action_moins():
global consigne global consigne