MicroPython 1.0.0, ev3dev Linux echo 4.14.96-ev3dev-2.3.2-ev3 #1 PREEMPT Sun Jan 27 21:27:35 CST 2019 armv5tejl GNU/Linux
#!/usr/bin/env pybricks-micropython
from pybricks import ev3brick as brick
from pybricks.ev3devices import Motor
from pybricks.parameters import Port, Stop
from pybricks.tools import print, wait
leftMotor = Motor(Port.B)
rightMotor = Motor(Port.C)
# speed range -100 to 100
def leftWheel():
leftMotor.run_target(50, 360, Stop.COAST, True)
def rightWheel():
rightMotor.run_target(50, -360, Stop.COAST, True)
leftWheel()
rightWheel()
This works if I use True, so it runs left then right. But if I set it false it does nothing. [should run both in parallel]
When you choose
wait=False
, therun_target
command is initiated and your program continues with the rest of your program right away. The motor completes its command in the background.But if there is nothing else in your program, the program ends right away. And when the program ends, the motors are stopped so you don't see any movement in this case.
You will see the motors move if there is something else in your program like a wait:
If your goal is to wait until both motors have reached their target, you could instead wait until the
angle
values of each motor equal your given targets: