Teacher Notes: Traversing a known tunnel using Python Pro Preview

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1624
  • 02 Jul 2020

The tunnel can be partially open

Cardboard Boxes

It's possible for you to have cardboard boxes - something from the school, shoe boxes, candy boxes, etc.

The only important criteria is for the boxes to be higher than 20cm so that they are higher than the robots.

Example solutions

Example solutions to the task "Program the robot to move until the touch sensor is pressed.":

# Create your objects here. 
ev3 = EV3Brick() 

touch = TouchSensor(Port.S1) 

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

# Write your program here. 
ev3.speaker.beep() 

while not touch.pressed(): 
    left_motor.run(500) 
    right_motor.run(500) 

left_motor.brake()
right_motor.brake()

Example solution to the task "Program the robot, after the touch sensor has been pressed, to turn by moving only one motor backwards.":

# Create your objects here. 
ev3 = EV3Brick() 

touch = TouchSensor(Port.S1) 

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

# Write your program here. 
ev3.speaker.beep() 

while not touch.pressed(): 
    left_motor.run(500) 
    right_motor.run(500) 

left_motor.brake()
right_motor.run_time(-700, 1000)

Example solution to the task "Program the robot to go through the entire maze by checking when it should turn with the touch sensor. Keep putting comments in your code!":

# Create your objects here. 
ev3 = EV3Brick() 

touch = TouchSensor(Port.S1) 

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

# Write your program here. 
ev3.speaker.beep() 

# Move forward till you reach the first wall

while not touch.pressed(): 
    left_motor.run(500) 
    right_motor.run(500) 

# Turn right

left_motor.brake()
right_motor.run_time(-700, 1000)

# Move forward till you reach the second wall

while not touch.pressed(): 
    left_motor.run(500)   
    right_motor.run(500) 

# Turn left

right_motor.brake()
left_motor.run_time(-700, 1000)

# Move forward till you reach the third wall

while not touch.pressed(): 
    left_motor.run(500)
    right_motor.run(500) 

# Turn right

left_motor.brake()
right_motor.run_time(-700, 1000)

# Move forward till you reach the last wall

while not touch.pressed():
    left_motor.run(500)
    right_motor.run(500) 

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 2
  • 39
  • 19:58
  • 93