import machine
from utime import sleep

def main():
    s0 = machine.Pin(27, machine.Pin.OUT)
    mux_in = machine.Pin(26, machine.Pin.IN, machine.Pin.PULL_DOWN)

    last_dev = 0
    while True:
        binary_code = 0
        for selector_val in range(2):
            s0.value(selector_val % 2)
            sleep(0.02)
            binary_code += (pow(2, selector_val) * mux_in.value())

        if last_dev != binary_code:
            last_dev = binary_code
            print(f'selected output: {last_dev}')
        sleep(0.1)

if __name__ == "__main__":
    main()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT

ERC Warnings

and1:A: Input pin not driven
and2:A: Input pin not driven
and1:B: Input pin not driven
not1:IN: Input pin not driven