Skip to main content

Lesson 3: Drive to Number ‘1’

  • Reset the Playground to move the VR Robot back to the starting position.
  • Now, the VR Robot will turn around and return to the number ‘1’ once it reaches number ‘31’ on the Number Grid Map Playground.
    L3_x-axis-go-to-31-with-arrows02
  • Remove the [Stop driving] block and replace it with the following blocks.
    add-blocks-to-turn-around
  • Note that the second [Wait until] block contains a <Less than> block instead of a <Greater than> block. This is because the VR Robot is now driving down the Y axis and the numbers are becoming more negative. The VR Robot will stop once the Y-values are LESS than -900.
    less-than
  • Launch the Number Grid Map Playground if it is not already open, and run the project.
  • Watch the VR Robot drive to number ‘1’ on the Number Grid Map Playground.
  • In this project, the VR Robot drives to the number ‘1’ on the Number Grid Map Playground. Since the Y-values are decreasing as the VR Robot drives to the number ‘1,’ the project uses a <Less than> block.
  • The VR Robot will stop once its Y-value is less than the Y-value of the coordinate that the indicated number is on. Since the Y-value of the number ‘1’ is -900, the VR Robot will stop driving once the Y-value is less than -900.
    project-flow-unit-6-lesson-3-part-2

    For Your Information

    Comments are usually added to projects to explain what a programmer wants parts of a project to do. Comments are helpful when collaborating and troubleshooting, as they provide context and overall meaning to the code. Using comments allows the programmer to think conceptually about the overall goal and intention of the project, instead of trying to “guess and check.” Do you want to remember what coordinates go with a certain number? Add a comment saying “Drive to 81 located at (-900, 700).” This helps to communicate different sections and blocks of the project.

    comments

    For more information on comments, view the Comments - VR Blocks article.

Select the Next button to continue with the rest of this Lesson.