class Sensor:
    def __init__(self, sensor_pin: int) -> None:
        self.sensor_pin = sensor_pin
        self.button = Button(sensor_pin)

    def read(self) -> bool:
        """Returns if the sensor is active."""
        return bool(self.button.is_active())
Exemplo n.º 2
0
    print("patata")

    audioThread = new AudioThread()

    try:

        #BUTTONS:
            #UP/DOWN: SELECT AUDIO
            #SWITCH: NORMAL/RED MODE
            #BUTTON: PLAY
            #SWITCH: RANDOM PLAY

        #GPIO Pins: 5, 6, 13, 19, 26
        button_up = Button(5)
        button_down = Button(6)
        switch_mode = Button(13)
        button_play = Button(19)
        switch_random = Button(26)

        while True:

            if switch_random.is_active():
                #MODO RANDOM

            else:




    except:
        logging.warn('GPIO Transl.: No GPIO found')