Skip to main content

Lesson 2: Using the Front Eye Sensor with [Wait until]

In this Lesson, you will create a project using the Front Eye Sensor with the [Wait until] block to navigate the VR Robot through the Disk Maze Playground. Your project will instruct the VR Robot to turn right when a green disk is detected, and left when a blue disk is detected by the Front Eye Sensor. In the mini challenge, you will apply these skills to drive the VR Robot to each disk in the Disk Maze Playground and finish at the red disk.

A view of the Disk Maze playground, with the VR robot having reached the finish line and the path it took across the playground marked with arrows.

Learning Outcomes

  • Identify that the [Wait until] block can be used with the Eye Sensor.

Name and Save the Project

This project will use the [Wait until] block to instruct the VR Robot to turn when the Front Eye Sensor detects the first (green) colored Disk on the Disk Maze Playground.

A top-down view of the Disc Maze playground, with an arrow showing the intended path of the VR robot. The robot should drive forward from the starting platform to reach the first green disk, and then turn right after detecting it.
  • Start a new project in VEXcode VR and name the project Unit7Lesson2.

    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 7 Lesson 2.
  • To begin, the VR Robot will need to drive toward the first disk on the Disk Maze Playground. Drag the [Drive] block into the work space. Remember that you can use VEXcode blocks, Switch blocks, or a combination of both block types to build your project. 

    A VEXcode VR blocks project that beginning with a When Started block followed by a comment that reads 'drive to first disk (green), then turn right'. Lastly, there is a Drive Forward block highlighted with a red box.
  • This example project will use comment blocks to remind the user what the intention is for the behaviors of the VR Robot during the following section of the project.

    VEXcode VR Comment block, with the default text of 'comment'.
  • Add the [Wait until] block and place the <Color sensing> block inside. The first disk that the VR Robot will encounter will be green. Select ‘green’ as the color to be detected.

    The VEXcode VR blocks project from earlier with a Wait Until Front Eye detects green block added after the Drive Forward block. The whole project begins with a When Started block followed by a Comment reading 'drive to first disk (green), then turn right'. Next, there is a Drive Forward block followed by a Wait Until block with a Color Sensing block that reads 'Front Eye detects green'.
  • Add a [Turn for] block to instruct the VR Robot to turn right 90 degrees when it detects a green disk.

    The VEXcode VR blocks project from earlier with a Turn Right for 90 degrees block added after the Wait Until block. The whole project now reads When Started then a Comment reading 'drive to first disk (green), then turn right'. Next, Drive Forward and Wait Until Front Eye detects green. Lastly, turn right for 90 degrees.
  • Open the Disk Maze Playground if it is not already open, and run the project.
  • Watch the VR Robot drive forward to the first green disk then turn right.

    The VR Robot on the Disc Maze playground driving towards the first green disc. A marked arrow indicates that it should turn right once it reaches it.
  • Notice that the VR Robot drives forward until the condition of the <Color sensing> block reports TRUE. Then, it executes the next block in the stack, which is to turn right for 90 degrees.

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