Teacher Version
Square Dance: Part 3
Repeat Until Touch Sensor
Set the Loop's mode to Touch Sensor instead of Ultrasonic Sensor. Make sure the arm is raised on the robot.
Run the program and try to get the robot to stop!
At the beginning of the Loop, the robot will check the Touch Sensor, instead of the Ultrasonic Sensor, 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.
Square Lap 3
Make your robot run laps around the box until it encounters an obstacle in its way. The obstacle will be placed so that it is visible to the robot immediately after it turns.
Facing 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.
- Use the same setting used in Square Dance: Part 1.
- Make your robot run laps around the box until it encounters an obstacle in its way. The obstacle will be placed so that it is visible to the robot immediately after it turns. See the diagram below to see where the obstacles should be placed.
Virtual Robot: SquareDance3VR.rbg
Physical Robot: SquareDance3.rbg