Skip to main content

Lesson 3: Using Reported Sensor Feedback to Pick Up Disks

This Lesson will use reported sensor feedback to solve the same challenge as Lesson 2. The VR Robot will pick up and move the first blue disk into the blue goal.

  • Start a new project in VEXcode VR and name the project Unit8Lesson3.
    Unit8Lesson3 Named
  • Drag four Comment blocks into the workspace. Add comments for each of the steps necessary for the VR Robot to drive to the first disk, pick it up, and return it to the blue goal.
    Add comments Lesson 3
  • Drag a [Repeat until] block into the workspace beneath the first comment.
    Add repeat until

For Your Information

The [Repeat until] block is a C block that accepts Boolean reporter blocks. The [Repeat until] block will only check the Boolean condition at the beginning of each loop. If the Boolean condition is reported as FALSE, the blocks inside will run. If the Boolean condition is reported as TRUE, the blocks inside will be skipped.

repeat until block
  • The <Eye Sensor near object> block reports TRUE when the VR Robot detects a colored disk on the Disk Mover Playground. Drag this block into the project.
    Add eye sensor
  • The disks on the Disk Mover Playground are on the floor of the Playground and cannot be detected by the Front Eye Sensor. For this reason, set the <Eye Sensor near object> block to ‘DownEye.’
    set to down eye
  • The blocks on the inside of the [Repeat until] block will run when the VR Robot does NOT detect an object. To reach one of the disks, the VR Robot will need to drive forward until the disk is detected.
    FIXED_Disk Mover Start Position_Black_Pen
  • Drag a [Drive] block into the [Repeat until] block.
    Add drive forward
  • When a disk is detected, the VR Robot will need to stop driving in order to pick it up. Drag a [Stop driving] block and place it beneath the [Repeat until] block.
    stop driving
  • Now, instruct the VR Robot to pick up the disk with the Electromagnet by placing an [Energize Electromagnet] block below the second comment.
    Energize magnet
  • Open the Disk Mover Playground if it is not already open and run the project.

  • The VR Robot drives forward until the first blue disk is detected by the Down Eye Sensor, stops driving, and energizes the Electromagnet to pick up the disk.
    u8_Lesson3_FirstPuck_0
  • Notice how the [Repeat until] block works in this project.

    • Once the Down Eye Sensor on the VR Robot detects an object, the project moves to the next block in the stack below the [Repeat until] block.

    • In this project, that meant the VR Robot stopped driving and energized the Electromagnet.
Repeat unit project flow

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