Repeat Until Touch SensorSet the Loop's mode to Touch Sensor instead of Distance Sensor. Make sure the arm is raised on the robot.
The robot will check the Touch Sensor instead of the Distance Sensor
at the beginning of the Loop to see whether it will send Flow in or leave the Loop.
If the Touch Sensor is being pressed in at the time the Loop begins, the robot will stop! If not, it will move forward and backward as intended until the Touch Sensor is pressed.
Mini Challenge 1: Square Dance 3Facing obstacles is a very common problem a robot faces. You can use loops to anticipate for an obstacle and stop the robot before it hits the object.