Herunterladen Diese Seite drucken

Werbung

Erste Schritte mit
LEGO
 MINDSTORMS
Education EV3
®
®
MicroPython
Version 1.0.0

Werbung

loading

Inhaltszusammenfassung für LEGO MINDSTORMS Education EV3 MicroPython

  • Seite 1 Erste Schritte mit LEGO  MINDSTORMS Education EV3 ® ® MicroPython Version 1.0.0...
  • Seite 2 Tools – Zeit- und Datenerfassung ............................Robotik – Robotikmodul ..................................Signale und Einheiten ..................................... Robot Educator ........................................10 Farbsortierer ........................................... 11 Roboterarm H25 ........................................ Python-Modulverzeichnis ....................................Verzeichnis ............................................. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 3 EV3 Stein herunterlädt. Außerdem erfährst du, wie man das Programm über den Computer oder den EV3 Stein ausführt. Nachdem du das erste Demo-Programm ausgeführt hast, kannst du die Beispielprogramme ausprobieren und eigene Programme erstellen. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 4 über einen USB-Stecker angeschlossen wird. • Ein Mini-USB-Kabel (im Lieferumfang des EV3 Sets enthalten) Abbildung 1.1 zeigt, wie diese Komponenten miteinander verbunden werden. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 5 2. Den Anweisungen auf dem Bildschirm folgen, um die Anwendung zu installieren. 3. Visual Studio Code starten. 4. „Extensions“ (Erweiterungen) öffnen. 5. Die Erweiterung „EV3 MicroPython“ wie in Abbildung 1.2 dargestellt installieren. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 6 Deine microSD-Karte auswählen. Achte darauf, dass das Gerät und die Größe mit deiner microSD- Karte übereinstimmen. c. Den Flashing-Prozess starten. Dies kann einige Minuten dauern. Die Karte nicht entfernen, bis der Flashing-Prozess abgeschlossen ist. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 7 1.5 Verwenden des EV3 Steins Vergewissere dich, dass der EV3 Stein ausgeschaltet ist. Setze dann die vorbereitete microSD-Karte in den microSD-Kartensteckplatz am EV3 Stein ein, wie in Abbildung 1.4 dargestellt. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 8 Um den EV3 Stein auszuschalten, Ausschaltmenü über die Zurück-Taste öffnen und dann mit der mittleren Taste „Power Off“ auswählen, wie in Abbildung 1.5 dargestellt. Hauptmenü Ausschalten Zurück-Taste drücken Abbildung 1.5: Ausschalten des EV3 Steins LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 9 Gehe dazu wie folgt vor: 1. Den EV3 Stein wie oben beschrieben ausschalten. 2. Warten, bis der Bildschirm und die Stein-Statusleuchte ausgeschaltet sind. 3. MicroSD-Karte entfernen. 4. EV3 Stein einschalten. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 10 Enter. Wenn du dazu aufgefordert wirst, wähle einen Speicherort für dieses Programm aus und bestätige deine Auswahl durch Klicken auf choose folder. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 11 Abbildung 2.4 dargestellt. Suche dann den bereits angelegten Projektordner heraus und klicke auf OK. Zudem kannst du über den Menüpunkt Open Recent die kürzlich verwendeten Projekte öffnen. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 12 • Den EV3 Stein einschalten. • Den EV3 Stein über das Mini-USB-Kabel an den Computer anschließen. • Die USB-Verbindung wie in Abbildung 2.5 dargestellt einrichten. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 13 Alternativ kann das Programm jederzeit gestoppt werden, indem man auf die Zurück-Taste des EV3 Steins drückt. Wenn das Programm irgendeine Ausgabe mit dem Befehl print erzeugt, wird diese im Ausgabefenster angezeigt. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 14 Du hast jetzt bereits ein einfaches Beispielprogramm ausgeführt. Nun kannst du dieses Programm ergänzen, um damit den Motor zu steuern. Zunächst muss ein großer Motor an Anschluss B des EV3 Steins angeschlossen werden, wie in Abbildung 2.7 dargestellt. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 15 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. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 16 Suche dazu mit dem file browser (Datei-Browser) auf dem EV3 Stein das gewünschte Programm heraus. Drücke anschließend auf die mittlere Taste, um das Programm auszuführen. Siehe Abbildung 2.9. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 17 Version 1.0.0 ® ® Datei-Browser öffnen Projektordner öffnen Programm ausführen Zum vorherigen Ordner zurückkehren Abbildung 2.9: Ausführen eines Programms über die Tasten auf dem EV3 Stein LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 18 Parameters color(Color) – Farbe des Lichts: Wähle Color.BLACK oder None aus, um das Licht auszuschalten. Beispiel: # Make the light red brick.light(Color.RED) # Turn the light off brick.light(None) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 19 # Play one of the built-in sounds brick.sound.file(SoundFile.HELLO) # Play a sound file from your project folder brick.sound.file(‘mysound.wav’) 3.4 Display ---------------> (0, 0) Hello World | (177, 127) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 20 # Display a custom image from your project folder brick.display.image(‘pybricks.png’) # Display a custom image at the top right of the screen, without clearing # the screen first brick.display.image(‘arrow.png’, Align.TOP_RIGHT, clear=False) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 21 # is below 7 Volt(7000 mV = 7V) brick.battery.voltage() < 7000: brick.sound.beep() classmethod battery.current() Hiermit wird der Strom abgerufen, den der Akku aktuell liefert. Returns Akkustrom. Return type current: mA LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 22 Mechanismus“ bzw. „Ausgabegeschwindigkeit für den Mechanismus“ usw., da das Übersetzungsverhältnis automatisch berücksichtigt wird. Die Einstellung gears ist nur für Motoren mit Drehsensor verfügbar. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 23 Parameters deg/s) – Geschwindigkeit des Motors run_time(speed, time, stop_type=Stop.COAST, wait=True) Hiermit läuft der Motor eine bestimmte Zeit lang mit einer konstanten Geschwindigkeit (Winkelgeschwindigkeit). LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 24 • wait (bool) – legt fest, ob das Fahrmanöver zuerst beendet sein muss, bevor der Rest des Programms ausgeführt wird (Standardeinstellung: True); Bedeutet, dass das Programm wartet, bis der Motor den Zielwinkel erreicht hat. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 25 Mit duty_limit lässt sich das Drehmoment des Motors während dieses Fahrmanövers kurzzeitig begrenzen. Diese Funktion ist nützlich, um zu verhindern, dass ein Getriebe- oder Hebelmechanismus mit dem vollen Motordrehmoment angetrieben wird. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 26 (kp, ki, kd, tight_loop_limit, angle_tolerance, speed_tolerance, stall_speed, stall_ time) Hiermit werden die Einstellungen für die Positions- und Geschwindigkeitsregler eingerichtet. Siehe auch die PID- und Standardparameter für jeden Motor. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 27 Returns True, wenn der Sensor gedrückt wird, bzw. False, wenn er nicht gedrückt wird Return type bool 4.2.2 Farbsensor class ColorSensor (port) LEGO  MINDSTORMS Education EV3 Farbsensor ® ® LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 28 Hiermit wird der relative Abstand zwischen dem Sensor und einem Objekt mithilfe von Infrarotlicht gemessen. Returns relativen Abstand von 0 (nah) bis 100 (weit entfernt) Return type relative distance: % LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 29 Messung durchführt. Returns True, falls Ultraschall erfasst wird, bzw. False, falls kein Ultraschall erkannt wird Return type bool LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 30 (angle) Hiermit wird der Drehwinkel des Sensors auf einen Sollwert eingestellt. Parameters angle (angle: deg) – Wert, auf den der Winkel zurückgesetzt werden soll LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 31 Bei den NXT und EV3 Motoren solltest du darauf achten, den Motor so anzusehen, dass sich die rote/ orange Welle unten rechts befindet. Parameter Positive Negative Geschwindigkeit Geschwindigkeit Direction.CLOCKWISE im Uhrzeigersinn entgegen dem Uhrzeigersinn Direction.COUNTERCLOCKWISE entgegen dem im Uhrzeigersinn Uhrzeigersinn LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 32 (continues on next |__ o \______________/ |__ o LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are trademarks and/or copyrights of the LEGO Group. © 2019 The LEGO Group. All rights reserved. Large EV3 Motor: \______________/ Großer EV3 Motor...
  • Seite 33 Anordnung eines Bildes auf dem Display BOTTOM_LEFT BOTTOM BOTTOM_RIGHT LEFT CENTER RIGHT TOP_LEFT TOP_RIGHT class ImageFile Pfad zu EV3 Standardbildern Information RIGHT FORWARD ACCEPT QUESTION_MARK STOP_1 LEFT DECLINE LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 34 Objekte TARGET Augen BOTTOM_RIGHT BOTTOM_LEFT EVIL CRAZY_2 KNOCKED_OUT PINCHED_RIGHT WINKING DIZZY DOWN TIRED_MIDDLE MIDDLE_RIGHT SLEEPING MIDDLE_LEFT TIRED_RIGHT PINCHED_LEFT PINCHED_MIDDLE CRAZY_1 NEUTRAL AWAKE TIRED_LEFT ANGRY LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 35 BOING UH_OH SNORING KUNG_FU FANFARE CRUNCHING MAGIC_WAND LAUGHING_1 Information LEFT BACKWARDS RIGHT OBJECT COLOR FLASHING ERROR ERROR_ALARM DOWN FORWARD ACTIVATE SEARCHING TOUCH ANALYZE STOP LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 36 OKEY_DOKEY GOOD THANK_YOU GAME_OVER OKAY SORRY BRAVO GOODBYE HELLO MINDSTORMS LEGO FANTASTIC Bewegungen SPEED_IDLE SPEED_DOWN SPEED_UP Farbe BROWN GREEN BLACK WHITE BLUE YELLOW Mechanisch LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 37 LASER SONAR MOTOR_START Tiere INSECT_BUZZ_2 ELEPHANT_CALL SNAKE_HISS DOG_BARK_2 DOG_WHINE INSECT_BUZZ_1 DOG_SNIFF T_REX_ROAR INSECT_CHIRP DOG_GROWL SNAKE_RATTLE DOG_BARK_1 CAT_PURR Zahlen ZERO THREE FOUR FIVE SEVEN EIGHT LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 38 Erste Schritte mit LEGO MINDSTORMS Education EV3 MicroPython Version 1.0.0 ® ® NINE System READY CONFIRM GENERAL_ALERT CLICK OVERPOWER LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 39 • Wenn die Stoppuhr angehalten wurde, bleibt sie stehen (steht jetzt aber auf 0). • Wenn die Stoppuhr lief, läuft sie weiter (beginnt aber erneut von 0). LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 40 = DriveBase(left, right, 56, 114) # Initialize a sensor sensor = UltrasonicSensor(Port.S4) # Drive forward until an object is detected robot.drive(100, 0) while sensor.distance() > 500: wait(10) robot.stop() LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 41 45, 3000) stop(stop_type=Stop.COAST) Hiermit wird der Roboter angehalten. Parameters stop_type(Stop)– legt fest, ob der Motor auslaufen, abbremsen oder die Position beibehalten soll (Standardeinstellung: Stop.COAST) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 42 Umrechnungstabelle (z. B. Umdrehungen pro Minute in der englischen Einheit rpm, die der SI-Einheit min-1 entspricht). deg/s 1 deg/s = 1/6=0,167 1 rpm = LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 43 Sekunde (deg/s/s) angegeben. Dies wird häufig auch als deg/s ausgedrückt. Beispielsweise kann man die Umdrehungsbeschleunigung von einem Motor so einstellen, dass der Sollwert für die konstante Geschwindigkeit schnell oder langsam erreicht wird. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 44 Spannungen werden in Millivolt (mV) angegeben. Zum Beispiel die Spannung des Akkus. 8.12 Strom: mA Elektrischer Strom wird in Milliampere (mA) angegeben. Zum Beispiel der vom Akku gelieferte Strom. LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 45 Daraufhin fährt er rückwärts, dreht sich und fährt dann weiter. Die Bauanleitungen für den Robot Educator findest du auf der LEGO Education Website. Abbildung 9.1: Robot Educator mit Ultraschallsensor LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 46 0, 2000) # Turn around at 60 degrees per second, around the midpoint between # the wheels. Keep going for 2 seconds. robot.drive_time(0, 60, 2000) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 47 Wenn die Halterung voll ist oder du auf die mittlere Taste drückst, beginnt der Roboter, die Elemente nach Farben zu sortieren. Die Bauanleitungen für den Farbsortierer findest du auf der LEGO  Education Website. ® Abbildung 10.1: Farbsortierer LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 48 # while the length of the list is still less than 8. while len(color_list) < 8: # Show an arrow that points to the color sensor. brick.display.image(ImageFile.RIGHT) (Fortsetzung auf der nächsten Seite) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 49 # Run the conveyor belt motor to the right position based on the color. color == Color.BLUE: brick.sound.file(SoundFile.BLUE) belt_motor.run_target(500, 10) elif color == Color.GREEN: brick.sound.file(SoundFile.GREEN) belt_motor.run_target(500, 132) (Fortsetzung auf der nächsten Seite) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 50 == Color.RED: brick.sound.file(SoundFile.RED) belt_motor.run_target(500, 530) # Now that the conveyor belt is in the correct position, # eject the colored object. feed_motor.run_angle(1500, 90) feed_motor.run_angle(1500, -90) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 51 Die Bauanleitungen für den Roboter findest du auf der LEGO Education Website. Tipp: Wenn du den Roboter baust, richte den EV3 Stein so aus, dass die microSD-Karte leicht zugänglich ist. Abbildung 11.1: Roboterarm H25 LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 52 # the zero point. Then hold the motor in place so it does not move. base_motor.run(-60) while not base_switch.pressed(): wait(10) base_motor.reset_angle(0) base_motor.stop(Stop.HOLD) (Fortsetzung auf der nächsten Seite) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 53 # Now we have a wheel stack on the left and on the right as before, but they # have switched places. Then the loop repeats to do this over and over. while True: (Fortsetzung auf der nächsten Seite) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 54 # Move a wheel stack from the right to the left. robot_pick(RIGHT) robot_release(LEFT) # Move a wheel stack from the middle to the right. robot_pick(MIDDLE) robot_release(RIGHT) LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 55 PYTHON-MODULVERZEICHNIS ev3brick, ev3devices, parameters, robotics, tools, LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 56 ImageFile.ANGRY (in module parameters), color () (ColorSensor method), ImageFile.AWAKE (in module parameters), Color.BLACK (in module parameters), ImageFile.BACKWARD (in module parameters), Color.BLUE (in module parameters), LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 57 SoundFile.CAT_PURR (in module parameters), light () (in module ev3brick), SoundFile.CHEERING (in module parameters), SoundFile.CLICK (in module parameters), SoundFile.COLOR (in module parameters), Motor (class in ev3devices), LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 58 SoundFile.MAGIC_WAND (in module parameters), SoundFile.WHITE (in module parameters), SoundFile.YELLOW (in module parameters), SoundFile.MINDSTORMS (in module parameters), SoundFile.YES (in module parameters), SoundFile.ZERO (in module parameters), LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.
  • Seite 59 (module), TouchSensor (class in ev3devices), track_target () (Motor method), UltrasonicSensor (class in ev3devices), voltage () (ev3brick.battery class method), wait () (in module tools), LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group. ©2019 The LEGO Group.