Skip to main content

Lesson 2: Change Parameters in the [Drive for] Block

The VR Robot did not touch the center castle in the last project. It needs to travel farther. Adjust the forward parameter, test it, and watch the VR Robot knock over the center castle!

  • Set the distance the VR Robot will move by entering the value 800 in the [Drive for] block.
    forward 800

For Your Information

The [Drive for] block can accept decimals, integers, or numeric blocks. The units can also be changed from millimeters (mm) to inches.

mm and inches
  • Start the project.
  • The VR Robot will collide with the center castle and knock parts of it over.
    knock down
  • Select the “Reset” button to reset the Playground.
    Restart Feature

    The VR Robot now needs to return to the starting position. Use an additional [Drive for] block and change the parameters to make it drive in reverse to return to the starting position.

  • Add a second [Drive for] block to the VEXcode VR project, and change the direction from “forward” to “reverse.”
  • Make sure the distance value is the same as the first [Drive for] block, 800 millimeters (mm), in order for it to return to the starting position.
  • Select the “Start” button and run the project.
  • The VR Robot will move forward and backward for 800 millimeters (mm), returning to the starting position.
    Forward and Backward

Note: You have successfully completed the first part of the Castle Crasher Challenge! Even if all four parts of the center castle are not completely knocked over, if they are slightly displaced, that is acceptable.

For Your Information

To make a VR Robot drive forward and reverse at different speeds, the drive velocity can be increased or decreased using the [Set drive velocity] block. The [Set drive velocity] block accepts a range from 0% - 100%. The default velocity is 50%. Changing velocity will apply to any subsequent Drivetrain commands.

drive vel

Save Your Project

To save your project, select “Save to Your Device in the “File” drop-down menu.

Save to Device

Once saved, the project will appear in the Downloads folder of your device as a .vrblocks file.


Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf