mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
23 lines
493 B
Python
23 lines
493 B
Python
from pybricks.ev3devices import Motor
|
|
from pybricks.hubs import EV3Brick
|
|
from pybricks.parameters import Port
|
|
|
|
# Create your objects here
|
|
|
|
# Initialize the EV3 Brick.
|
|
ev3 = EV3Brick()
|
|
|
|
# Initialize a motor at port B.
|
|
test_motor = Motor(Port.B)
|
|
|
|
# Write your program here
|
|
|
|
# Play a sound.
|
|
ev3.speaker.beep()
|
|
|
|
# Run the motor up to 500 degrees per second. To a target angle of 90 degrees.
|
|
test_motor.run_target(500, 90)
|
|
|
|
# Play another beep sound.
|
|
ev3.speaker.beep(frequency=1000, duration=500)
|