Lesson 3: Post-Project Summary
Why did the VR Robot continue driving when it reached the green disk?
When this project is run, the VR Robot continues to drive forward even when colliding with the first green disk, as is shown in the video below.
Video file
This project only instructs the VR Robot to check the conditions of each if else statement once at the beginning of the project.
The if statement is different from the while loop
- While loops do not require a decision to be made by the VR Robot. When the condition is True, the while loop with a not condition executes the next command outside the loop. When the condition is False, the while loop with a not condition continues to wait until the condition is True, and stops the rest of the project from running.
- If statements require the VR Robot to make a decision. If the condition is True, then the commands inside the if statement are executed. If the condition is False, then the commands inside the if statement are not executed.
- The Front Eye sensor detects no color at the beginning of the project, thus the last if statement returns True. The VR Robot will continue to drive forward since the last if statement was reported as True and all other blocks were reported as False at the beginning of the project.
- Notice that there aren't any loops in this project that can pause the project flow to repeatedly check a condition. The if statement checks the condition once, then moves on.
- Save the project before moving on to the next Lesson, to learn about adding repeatedly checking conditions with if statements.