Skip to content
Discussion options

You must be logged in to vote
from pybricks.hubs import CityHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Direction, Port, Stop
from pybricks.tools import multitask, run_task, wait

hub = CityHub()
X_Motor = Motor(Port.A, Direction.CLOCKWISE)
Y_Motor = Motor(Port.B, Direction.CLOCKWISE)

async def test_function(x_coord, y_coord):
    await multitask(
        X_Motor.run_target(500, x_coord, Stop.COAST),
        Y_Motor.run_target(500, y_coord, Stop.COAST))

async def main():
    await test_function(800, 390)
    await wait(1000)

run_task(main())

All functions that await need to be async and all functions that are async need to be awaited.

run_task() and multitask are special in that they t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jormono1
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