from machine import * from utime import * motor_a = Pin(10, Pin.OUT) motor_b = PWM(Pin(9)) motor_b.freq(1000) led_1 = Pin(6, Pin.OUT) led_2 = Pin(7, Pin.OUT) sensor = Pin(8, Pin.IN) sensorwert = 0 motor_a.value(0) motor_b.duty_u16(0) sleep(1) while True: sensorwert = sensor.value() if sensorwert == 0: motor_a.value(0) motor_b.duty_u16(32768) led_1.value(1) led_2.value(1) else: motor_a.value(0) motor_b.duty_u16(0) led_1.value(0) led_2.value(0)