Files
pybricks-api/examples/ev3/getting_started/main.py
T
Laurens Valk adf8ed6b56 pybricks.hubs: Enable EV3.
First pass including Image and ImageFile. Largely migrated from old ev3dev version. We can refine this for the embedded version in the next commits.
2026-08-25 11:42:05 +02:00

23 lines
493 B
Python

from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
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)