from machine import ADC, Pin
from time import sleep

pot = ADC(26)
pot2 = ADC(27)
but = Pin(28, Pin.IN, Pin.PULL_UP)
ledr = Pin(0, Pin.OUT)
ledg = Pin(1, Pin.OUT)
ledy = Pin(2, Pin.OUT)
z = 0
while True:
    if but.value() == 0:
        sleep(1)
        x = pot.read_u16()
        y = pot2.read_u16()
        print('este e o valor de x: ',x)
        print('este e o valor de y: ',y)
        sleep(1)
        z = x - y
        if z <= 20000:
            sleep(1)
            ledr.on()
            ledg.off()
            ledy.off()
        elif z >20000 and z <= 40000 :
            sleep(1)
            ledr.off()
            ledg.off()
            ledy.on()
        else:
            sleep(1)
            ledr.off()
            ledg.on()
            ledy.off()
        print('este e o valor de z: ',z)
    else:
        sleep(1)
        print('aperte o botao')

    


BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT