def __init__(self, port_name, name="button"): self._pma_port = port_name self.name = name Stateful.__init__(self) Recreatable.__init__(self, {"port_name": port_name, "name": self.name}) gpiozero_Button.__init__(self, get_pin_for_port(self._pma_port))
def __init__(self, pin: int, led: LED): Button.__init__(self, pin, pull_up=None, active_state=False) self.count = 0 self.contact_mark = datetime.now() self.when_activated = self.contact self.when_deactivated = self.nocontact self.led = led
def __init__(self, pin: int): Thread.__init__(self) Button.__init__(self, pin, pull_up=None, active_state=False) self.when_activated = self.contact self.when_deactivated = self.released self.lock_active = Lock() self.lock_inactive = Lock() self.lock_active.acquire() self.exit_event = Event()
def __init__(self, btn_pin: int, pump_led: LED, circ_intern_led: LED, circ_outer_led: LED, off_led: LED): Button.__init__(self, btn_pin, pull_up=None, active_state=False) self.count = 0 self.contact_mark = datetime.now() self.when_activated = self.contact self.when_deactivated = self.nocontact self.pump_led = pump_led self.circ_intern_led = circ_intern_led self.circ_outer_led = circ_outer_led self.off_led = off_led self.off_led.on() self.state = STATE_OFF
def __init__(self, pin, myaction, playlist=None): Button.__init__(self, pin, hold_time=1) self.action = myaction self.playlist_name = playlist self.shortpress = True if myaction == Action.PLAYPAUSENEXT: # trigger short press self.when_released = next_song # long press : play/pause self.when_held = play_pause elif myaction == Action.PLAYLIST: socketIO.on('pushBrowseLibrary', on_browse_library) self.when_released = play_song_from_playlist self.when_held = add_music_to_playlist elif myaction == Action.PREVIOUSCLEAR: # trigger short press self.when_released = previous # long press self.when_held = clearQueue elif myaction == Action.DISPLAY: # trigger short press self.when_released = next # long press self.when_held = switch_on_off
def __init__(self, pin, buttonvalue, on_short_press, on_long_press=None): Button.__init__(self, pin) self.buttonvalue = buttonvalue self.on_short_press = on_short_press self.on_long_press = on_long_press self.when_pressed = self.handle_press
def __init__(self, pin, button_pressed_handler): Button.__init__(self, pin, pull_up=None, active_state=False) self.when_activated = self.pressed self.when_deactivated = self.released self.pressed_at = None self.button_pressed_handler = button_pressed_handler
def __init__(self, pin, color): Button.__init__(self, pin) self.color = color
def __init__(self, ioNumber, time_held): ''' Constructeur ''' Button.__init__(self, pin=ioNumber, pull_up=False, hold_time=time_held)