from pybricks.pupdevices import DCMotor
from pybricks.parameters import Port
from pybricks.tools import wait

# Initialize a motor without rotation sensors on port A.
example_motor = DCMotor(Port.A)


while True:
    # Make the motor go clockwise (forward) at 50% duty cycle ("50% power").
    example_motor.dc(50)

    # Wait for three seconds.
    wait(3000)

    # Make the motor go counterclockwise (backward) at 50% duty cycle.
    example_motor.dc(-50)

    # Wait for three seconds.
    wait(3000)