code/examples/02-gpio/button_debounce.py
def wait_pin_change(pin):
    """
    wait for pin to change value
    returns after pin stays in changed state for a continuous 20ms
    """
    # read current pin state
    cur_value = pin.value()
    active = 0
    # infinite loop, if no pin change
    while active < 20:
        if pin.value() != cur_value:
            active += 1
        else:
            active = 0
        time.sleep_ms(1)

    wait for pin to change value
    returns after pin stays in changed state for a continuous 20ms
    
wait for pin to change value
returns after pin stays in changed state for a continuous 20ms
wait for pin to change value returns after pin stays in changed state for a continuous 20ms
def wait_pin_change(pin):
    cur_value = pin.value()
    active = 0
    while active < 20:
        if pin.value() != cur_value:
            active += 1
        else:
            active = 0
        time.sleep_ms(1)
def wait_pin_change ( pin ) : cur_value = pin . value ( ) active = 0 while active < 20 : if pin . value ( ) != cur_value : active += 1 else : active = 0 time . sleep_ms ( 1 )
wait for pin to change value
returns after pin stays in changed state for a continuous 20ms
wait for pin to change value returns after pin stays in changed state for a continuous 20ms
"""
    wait for pin to change value
    returns after pin stays in changed state for a continuous 20ms
    """ # read current pin state # infinite loop, if no pin change
pin