import utime
import machine


s0 = machine.Pin(0, machine.Pin.OUT)
s1 = machine.Pin(1, machine.Pin.OUT)
s2 = machine.Pin(2, machine.Pin.OUT)
s3 = machine.Pin(3, machine.Pin.OUT)


adc = machine.ADC(26)

mux = [   
    [0,0,0,0], #0 = C0
    [1,0,0,0], #1
    [0,1,0,0], #2
    [1,1,0,0], #3
    [0,0,1,0], #4
    [1,0,1,0], #5
    [0,1,1,0], #6
    [1,1,1,0], #7
    [0,0,0,1], #8
    [1,0,0,1], #9
    [0,1,0,1], #10
    [1,1,0,1], #11
    [0,0,1,1], #12
    [1,0,1,1], #13
    [0,1,1,1], #14
    [1,1,1,1], #15
]



def val_analog(cx):
    s0.value(mux[cx][0])
    s1.value(mux[cx][1])
    s2.value(mux[cx][2])
    s3.value(mux[cx][3])

    
    analog_read = adc.read_u16()  
    #return analog_read   
    print('C',cx, ' = ', analog_read)
    utime.sleep_ms(250)
    #cr = adc.read_u16()
    #print('Wert C'+ str(val_analog) + str(cr))
    

#pinCx = list(range(0,15))

while True: 


    c0 = val_analog(0)
    #print(c0)  
    #c0r = adc.read_u16()
    #print("C0 = ", c0r)
    c1 = val_analog(1)
    #c1r = adc.read_u16()
    #print("C1 = ", c1r)
    c2 = val_analog(2)
    #c2r = adc.read_u16()
    #print("C2 = ", c2r)
    c3 = val_analog(3)
    #c3r = adc.read_u16()
    #print("C3 = ", c3r)  

    #print("c0 = ", c0, "|c1 = ",c1,"|c2 = ",c2,"|c3 = ",c3)

    #utime.sleep_ms(250)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT