forked from pybricks/pybricks-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/LEGO-Robotics/Pybricks-API
- Loading branch information
Showing
31 changed files
with
1,100 additions
and
493 deletions.
There are no files selected for viewing
This file was deleted.
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
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
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
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
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
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()) |
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,16 @@ | ||
from pybricks.tools import hub_menu | ||
|
||
# This example assumes that you have three other programs in Pybricks Code, | ||
# called "fly_mission", "drive_mission", and "zigzag". This example creates a | ||
# menu that lets you pick which one to run. | ||
|
||
# Choose a letter. | ||
selected = hub_menu("F", "D", "Z") | ||
|
||
# Based on the selection, run a program. | ||
if selected == "F": | ||
import fly_mission | ||
elif selected == "D": | ||
import drive_mission | ||
elif selected == "Z": | ||
import zigzag |
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
Oops, something went wrong.