What we see in main.py Pro Preview

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1522
  • 28 Jan 2020
#!/usr/bin/env pybricks-micropython

from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
                                 InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color,
                                 SoundFile, ImageFile, Align)
from pybricks.tools import print, wait, StopWatch
from pybricks.robotics import DriveBase

# Write your program here
brick.sound.beep()

The entire code between the green lines introduce commands that we can use below them. We will look at them in-depth later on.
 

The green lines of code are comments that are not executed when the programs start. When we place the "#" symbol at the beginning of a line, everything on that line is considered a comment and is not executed by the program. This allows us to take notes within the code file.

 

The last line in the code "brick.sound.beep()" is the command for playing a "Beep" sound. We leave it in the program to know when the program has begun executing. You must begin every program you make after the "brick.sound.beep()" command.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 1
  • 43
  • 22:57
  • 30
Image for Lesson 1 - Beverage Assistant
  • 14
  • 4
  • 6
  • 3d_rotation 1