Skip to content

Switch as Input? #2408

Closed Answered by oliboss
oliboss asked this question in Q&A
Discussion options

You must be logged in to vote

In case someone is struggling with the same question in the future the following code works for me:

class Switch(NameMixin, ButtonBase):
    """
    A single switch that runs the on_press action whenever it is toggled. 

    :param pull_up: See #Button

    :param active_state: See #Button

    :param bounce_time: See #Button

    :param hold_time: See #Button

    :param pin_factory: See #Button

    :param name: See #Button
    """
    def __init__(
            self, pin=None, *, pull_up=True, active_state=None,
            bounce_time=None,
            hold_time=1, hold_repeat=False,
            pin_factory=None,
            name=None):
        super().__init__(
            pin=pin, pu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by s-martin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
future3 Relates to future3 development
1 participant