-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signaltypes: Bare minimal async docs.
This is nowhere near complete, but provides handles to start documenting async for the relevant methods.
- Loading branch information
1 parent
1a49d39
commit 9061b42
Showing
4 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pybricks.pupdevices import Motor | ||
from pybricks.parameters import Direction, Port | ||
from pybricks.robotics import DriveBase | ||
from pybricks.tools import multitask, run_task | ||
|
||
# Set up all devices. | ||
left = Motor(Port.A, Direction.COUNTERCLOCKWISE) | ||
right = Motor(Port.B) | ||
gripper = Motor(Port.C) | ||
drive_base = DriveBase(left, right, 56, 114) | ||
|
||
|
||
# Move the gripper up and down. | ||
async def move_gripper(): | ||
await gripper.run_angle(500, -90) | ||
await gripper.run_angle(500, 90) | ||
|
||
|
||
# Drive forward, turn move gripper at the same time, and drive backward. | ||
async def main(): | ||
await drive_base.straight(250) | ||
await multitask(drive_base.turn(90), move_gripper()) | ||
await drive_base.straight(-250) | ||
|
||
|
||
# Runs the main program from start to finish. | ||
run_task(main()) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters