Skip to main content

Lesson 3: Monitoring Sensor Values

In the previous Lesson, you used the Distance Sensor and comparison blocks for the VR Robot to drive from start to the number ‘1’ on the Wall Maze Playground. In this Lesson, you will learn how to monitor the values from sensors in the Monitor Console, and have the VR Robot drive from start to the letter ‘B’ on the Wall Maze Playground.

A top-down view of the wall maze with the letter B goal highlighted in a red box.

Learning Outcomes

  • Identify that the value of the Distance Sensor can be monitored by selecting and dragging the <Distance found object> or (Distance from) block to the Monitor Console icon in the Workspace.
  • Describe the benefit of being able to monitor sensor values when creating VEXcode VR projects.

Start a New Project

  • Start a new project in VEXcode VR and name the project Unit5Lesson3.

    VEXcode VR Toolbar with the 'Project Name' button highlighted in a red box, to the left of the Select Playground button. The project name is set to Unit 5 Lesson 3.

Drive to the Letter ‘B’

  • This Lesson will build a project for the VR Robot to drive to the letter ‘B’ on the Wall Maze Playground using the Distance Sensor.

    The same wall maze diagram as before, with the letter B goal highlighted in a red box.
  • Build the following VEXcode VR project using VEXcode blocks, Switch blocks, or a combination of both types. The goal of this lesson is to drive to the letter ‘B’, but the following project has an error.
    VEXcode VR blocks project that tries to reach the letter B goal, but has an error. There are 21 blocks following the When Started block. Consider the Drive Forward, Wait Until Front Distance in millimeters is less than 50, and then Turn 90 degrees commands to be one section of code. There are 6 of these sections, turning left, then right, then left twice, then right twice. To finish the project there is another Wait Until Front Distance in millimeters in less than 50 block and finally a Stop Driving block.
  • Launch the Wall Maze Playground if it is not already open and run the project.
  • Notice that the VR Robot does NOT reach the letter ‘B.’ Why not? Run the project again to identify the error.
    A top-down view of the Wall Maze, but with the VR robot at the wrong ending position and not at the letter B goal as one might expect. This shows that there is an error in our program.
  • When the VR Robot reaches this point in the Wall Maze, the VR Robot needs to turn left to reach the letter ‘B.’ At this turn, the VR Robot is further away from the wall than other turns. The Distance Sensor can be used to allow the VR Robot to make turns at any distance away from a wall.

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