from time import *
from machine import Pin
sleep(0.1) # Wait for USB to become ready
btn_red = Pin(9, Pin.IN)
led_red = Pin(7, Pin.OUT)
Am = Pin(13, Pin.OUT)
Ap = Pin(12, Pin.OUT)
Bp = Pin(11, Pin.OUT)
Bm = Pin(10, Pin.OUT)
def engine():
sleep_ms(1)
Bm.value(0)
Ap.value(1)
sleep_ms(1)
Ap.value(0)
Bp.value(1)
sleep_ms(1)
Bp.value(0)
Am.value(1)
sleep_ms(1)
Am.value(0)
Bm.value(1)
while 1:
instruction = str(input('Введите команду: '))
if instruction == 'Motor on':
engine()
elif instruction == 'Led on':
led_red.value(1)
elif instruction == 'Led off':
led_red.value(0)