
To access the full video please subscribe to FLLCasts.com
- #1623
- 02 Jul 2020
Example solution 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() left_motor.run(500) right_motor.run(500) while not touch.pressed(): pass left_motor.brake() right_motor.brake()
Alternative solution:
# 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 sensor has been pressed, to turn in place instead of stopping.":
# 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.run_time(350, 1000, Stop.HOLD, False) right_motor.run_time(-350, 1000)
Example solution to the task "Put your program in a loop and let the robot walk around the room.":
# 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 True: while not touch.pressed(): left_motor.run(500) right_motor.run(500) left_motor.run_time(350, 1000, Stop.HOLD, False) right_motor.run_time(-350, 1000)
Example solution to the task "Program your robot to make a sound every time it collides with an obstacle.":
# 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 True: while not touch.pressed(): left_motor.run(500) right_motor.run(500) ev3.speaker.play_file(SoundFile.BOING) left_motor.run_time(350, 1000, Stop.HOLD, False) right_motor.run_time(-350, 1000)
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Python with LEGO Mindstorms EV3 - Level 2
In the second level of Python for EV3 robots, students learn in-depth the touch sensor. The sensor is used as an input device for manual control of machines, as well as a sensor for autonomous robots. In a pair of lessons, students build a control panel for the grabber and the movement of a crane. Programming wise, students learn how to fork code with "if-else" constructions, how to create conditional and forever loops with "while" and how to negate conditions with "not" operator. In the end of the lesson, robots can detect obstacles and avoid them, so that they traverse a simple labyrinth.
- 39
- 19:58
- 93

Lesson 6 - Automated vacuum cleaner
Introduction
Today we will create a robot that will behave like an automated vacuum cleaner!
One of the most annoying household chores an adult could have is cleaning their home. Which is why engineers invented the Roomba! And we're not talking about the dance, but rather a robotized home vacuum cleaner.
- 5
- 4
- 8
- 3d_rotation 1