Skip to content

drivebase turn until angle #919

Answered by laurensvalk
jeagh asked this question in Q&A
Jan 18, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Tip: When posting code, enclose it with three backticks ``` before and after. This keeps the indentation.

Depending on what you want to do, there are two ways.

1. Doing something else while you make a fixed turn

from pybricks.pupdevices import Motor
from pybricks.parameters import Port, Direction, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait

# Initialize both motors and the drive base.
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.B)
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=56, axle_track=112)

# Start turning, but don't wait.
drive_base.turn(90, wait=False)

# We can do something else until it is done.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jeagh
Comment options

Answer selected by laurensvalk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants