pybricks.tools
pybricks_blockWaitTime
wait
pybricks_variables_set_stopwatch
pybricks.tools.StopWatch
pybricks_blockStopWatchTime
pybricks.tools.StopWatch.time
pybricks_blockStopWatchDo_StopWatch_pause
pybricks.tools.StopWatch.pause
pybricks_blockStopWatchDo_StopWatch_resume
pybricks.tools.StopWatch.resume
pybricks_blockStopWatchDo_StopWatch_reset
pybricks.tools.StopWatch.reset
pybricks.tools.read_input_byte
light-matrix
pybricks.tools.hub_menu
../../../examples/pup/tools/hub_menu.py
3.3
These tools were previously located in the pybricks.geometry
module.
stm32-float
pybricks.tools.Matrix
pybricks.tools::Matrix.T
pybricks.tools::Matrix.shape
stm32-float
pybricks_blockVector
pybricks.tools.vector
pybricks.tools.cross
3.3
Pybricks supports cooperative multitasking using the async
and await
keywords. This allows operations that normally take some time to complete to run in parallel with other operations.
pybricks_blockMultiTask
pybricks.tools.multitask
pybricks.tools.run_task
The following example shows how to use multitasking to make a robot drive forward, then turn and move a gripper at the same time, and then drive backward.
../../../examples/pup/robotics/drivebase_async.py
Whenever you see a function or method prefixed by await
, this means that it supports multitasking. When running a coroutine with run_task
, all methods and functions prefixed by await
will act as coroutines.
If you don't use multitasking, you can ignore the await
keyword and write programs as usual. Specifically, when run_task
is not used, functions prefixed by await
will act as normal functions.