from machine import Pin,PWM,ADC   
import utime

button = Pin(18, Pin.IN)

QTI_L=Pin(39,Pin.IN,Pin.PULL_UP)
QTI_R=Pin(36,Pin.IN,Pin.PULL_UP)

def motor(L12,L13,R14,R15):
    PWM(Pin(12)).duty(L12) 
    PWM(Pin(13)).duty(L13) 
    PWM(Pin(14)).duty(R14) 
    PWM(Pin(15)).duty(R15)

if __name__ == '__main__':
    while button.value() == 1:
        pass
    else:
        while True:
            QTI_MAX = QTI_L.value() * 2 + QTI_R.value()
            if QTI_MAX == 0:
                motor(800,0,800,0)
            elif QTI_MAX == 1:
                motor(0,800,0,400)
            elif QTI_MAX == 2:
                motor(0,400,0,800)
            elif QTI_MAX == 3:
                motor(0,1000,0,1000)
