Already Pressed
What happens if you’re already holding down the Touch Sensor’s button when you start running the program? Try it!
The robot detects that the sensor is pressed and passes control to the StopMultipleMotors block. “Pressed” simply means “the button is in the pressed position”; it does not matter how or when it was pressed in! |
EV3 Buttons
The 5 buttons on the front of the EV3 (not counting the Cancel button) can be used as Touch Sensors too! Switch the "waitUntil" pulldown option to one of the "EV3 Buttons." Try it!
Once it’s running, press the middle button on the front of the EV3!
The Wait Block now waits for the middle button on the EV3 to be pressed. The robot then moves. |
Forward Until Release
The waitUntil control block can wait for the sensor to be “Released” as well as “Pressed”.
The robot moves forward until the Touch Sensor is “Released”, then stops. |
Mini Challenge 1: Vacuum
Program the robot to touch all four walls of a room, using its Touch Sensor to know when it has reached each wall.Make sure the Touch Sensor is positioned so it can detect when the robot reaches a wall.
The room is rectangular, so each wall is a 90-degree turn from the last.
Some fine tuning may help, such as slowing movement speeds, pausing after a turn, or backing away from a wall before turning.
Did you know?
How the Touch Sensor Works?