import machine
import utime

# Define the motor control pins
motor_A_input1_pin = machine.Pin(8, machine.Pin.OUT)
motor_A_input2_pin = machine.Pin(9, machine.Pin.OUT)

motor_B_input1_pin = machine.Pin(10, machine.Pin.OUT)
motor_B_input2_pin = machine.Pin(11, machine.Pin.OUT)

while True:
    user_input_left = input("Enter '0' for left motor forward or '1' for left motor backward: ").strip()
    user_input_right = input("Enter '0' for right motor forward or '1' for right motor backward: ").strip()

    if user_input_left in ['0', '1'] and user_input_right in ['0', '1']:
        direction_left = int(user_input_left)
        direction_right = int(user_input_right)

        motor_A_input1_pin.value(direction_left)
        motor_A_input2_pin.value(not direction_left)

        motor_B_input1_pin.value(direction_right)
        motor_B_input2_pin.value(not direction_right)

    else:
        print("Invalid input. Please enter '0' or '1' to set the motor direction.")


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