The goal is to get your robot as close to the wall as you can without touching it, as fast as you can, and have your Lego person remain standing on top of the robot for the entire race.
Use the Ultrasonic Sensor to detect the robot’s proximity to the wall.
- Which robot was the fastest?
- Which robot got the closest?
- Whose Lego person remained standing?
- The robot must start behind the start line.
- Your Lego person must stand freely on the robot. They cannot sit nor can they be strapped or tethered in anyway.
- The programming makes use of the sensor.
- EV 3 Robot in base configuration with the Ultrasonic Sensor attached. See Lego Building Instructions Manual pp. 42-47.
- Masking tape to mark a starting line on the floor. The start line should be parallel and about 4-5 feet from a wall.
- 1 Lego person for each robot
Note for Teachers
- Students learn attach a sensor to the robot and how to program it.
- Note that the Ultrasonic Sensor can measure centimeters or inches.
- Use this website to learn more about how to program the Ultrasonic Sensor:
- If the robot starts with too much power, the Lego person will fall off.
Programming Race to the Wall with Sensor
First, drag a <Move> Block from the pink Movement menu. To set the speed, choose appropriate power between 0 and 100.
Next, drag a <Wait> Block from the blue Sensor menu.
Select the block with the Ultrasonic Sensor (note the icon).
Select the correct port. Check where you plugged the sensor into the base: The ports are labelled 1-4.
Set the distance:
In the example, once the Ultrasonic Sensor detects an object that is less than 10 cm away, the next block will be run.
Finally, drag a second <Move> Block from the pink tab menu to stop the forward motion.
© 2022 Dr. Krista Francis & Stefan Rothschuh