Erste Schritte mit LEGO
Anschluss B
Abbildung 2.7: EV3 Stein mit einem an Anschluss B angeschlossenen großen Motor
Bearbeite nun das Programm main.py so, dass es am Ende wie folgt aussieht:
#!/usr/bin/env pybricks-micropython
from
pybricks
import
from
pybricks.ev3devices
from
pybricks.parameters
# Play a sound.
brick.sound.beep()
# Initialize a motor at port B.
test_motor = Motor(Port.B)
# 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.
# This time with a higher pitch(1000 Hz) and longer duration(500 ms).
brick.sound.beep(1000,
Mit diesem Programm geschieht Folgendes: Piepton, Motor dreht sich, Piepton in einer höheren Tonlage.
Führe das Programm aus, um zu überprüfen, ob es wie geplant funktioniert.
MINDSTORMS
®
®
ev3brick as brick
import
Motor
import
Port
500)
LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group.
©2019 The LEGO Group.
Education EV3 MicroPython
Großer Motor
Version 1.0.0
13