def __init__(self, pin): # High = light on self.led = Factory.getOneLed("GPIO-HIGH", pin) # Low = pressed self.btn = Factory.getButton("GPIO-LOW", pin + 1) self.__on_event = None self.btn.on_event(self, GroveLedButton.__handle_event)
def __init__(self, pin): # High = pressed self.__btn = Factory.getButton("GPIO-HIGH", pin) # single WS2812 LED self.led = Factory.getOneLed("WS2812-PWM", pin + 1) self.__on_event = None self.__btn.on_event(self, GroveKeycap.__handle_event)
def __init__(self, pin): # Low = pressed self.__led = Factory.getOneLed("GPIO-HIGH", pin) self.__btn = Factory.getButton("GPIO-LOW", pin + 1) self.__led.light(False) self.__on_release = None self.__on_press = None self.__btn.on_event(self, GroveLedButton.__handle_event)