Teacher's Notes Pro Preview

Prepare a field for today's lesson. This field needs to have a starting line, a wall that's approximately a meter after the starting line and some free space past the finish line so that the robots can also move backwards.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1546
  • 27 Feb 2020

Example solution to the task "Program the robot to move forward for 2 seconds without using commands other than run_time ().":

Motor(Port.B).run_time(360, 2000, Stop.COAST, False) 
Motor(Port.C).run_time(-360, 2000, Stop.COAST)

Example solution to the task "Program the robot to move backward, changing only the speed of the run_time () commands.":

Motor(Port.B).run_time(-360, 2000, Stop.COAST, False)
Motor(Port.C).run_time(360, 2000, Stop.COAST)

Example solution to the task "Create a variable with the name "time" for the time that the motors move and test your program.":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 2000

# Write your program here.
Motor(Port.B).run_time(-360, move_time, Stop.COAST, False)
Motor(Port.C).run_time(360, move_time, Stop.COAST)

Example solution to the task "Change the number that is kept in the "time" variable so that the robot moves for 3 seconds and test your program.":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 3000

# Write your program here.
Motor(Port.B).run_time(-360, move_time, Stop.COAST, False)
Motor(Port.C).run_time(360, move_time, Stop.COAST)

Example solution to the task "Create a variable for the speed of the motors and name it "speed".":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 3000
motor_speed = 360

# Write your program here. 
Motor(Port.B).run_time(motor_speed, move_time, Stop.COAST, False)
Motor(Port.C).run_time(motor_speed, move_time, Stop.COAST)

Example solution to the task "In the input parameter for the run_time command for the motor on port "C" write an equation that reverses the sign of the variable "speed" as "0 - speed" or "speed * (-1)".":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 3000
motor_speed = 360

# Write your program here. 
Motor(Port.B).run_time(motor_speed, move_time, Stop.COAST, False)
Motor(Port.C).run_time(0 - motor_speed, move_time, Stop.COAST)

Example solution to the task "Create variables for the motors.":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 3000
motor_speed = 360

left_motor = Motor(Port.B)
right_motor = Motor(Port.C)

# Write your program here. 
left_motor.run_time(motor_speed, move_time, Stop.COAST, False)
right_motor.run_time(0 - motor_speed, move_time, Stop.COAST)

Example solution to the task "Exchange the B and C ports of the variables you created and test the program.":

# Create your objects here. 
ev3 = EV3Brick()

move_time = 3000
motor_speed = 360

left_motor = Motor(Port.C)
right_motor = Motor(Port.B)

# Write your program here. 
left_motor.run_time(motor_speed, move_time, Stop.COAST, False)
right_motor.run_time(0 - motor_speed, move_time, Stop.COAST)

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
  • 74
  • 28:18
  • 114
Image for Lesson 4 - Strange Bot
  • 7
  • 5
  • 11
  • 3d_rotation 1