Why was the [drive] block used instead of the [drive for] block in this project?

Name:___________________________________________________Date:____________________Computer Science Fundamentals with VEXcode VR CourseUnit 4 - Lesson 2: Using the [Wait until] Block Quiz1.Which statement is TRUE for non-waiting blocks?a.They allow the stack to continue even if the block's behavior is not yet complete.b.They pause the rest of the stack until that block's behavior has been completed.c.They cause the VR Robot to shut down.d.They are always blocks from the Looks category.

In this Lesson, you will create a project using the Bumper Sensor and [Wait until] block. In the mini-challenge, you will apply these skills to navigate from the beginning of the Wall Maze to the letter ‘A.’

Why was the [drive] block used instead of the [drive for] block in this project?

Learning Outcomes

  • Identify that non-waiting blocks have the stack continue even if the block's behavior is not yet complete.
  • Identify that a waiting block pauses the stack until that block's behavior has been completed.
  • Identify that the highlighting of the project's execution visualizes waiting vs non-waiting blocks.
  • Identify that the [Wait until] block is a Control block that accepts Boolean values.
  • Identify that the [Wait until] block will repeatedly check a Boolean condition and will not move to the next block until the condition reports TRUE.
  • Identify that the [Wait until] block is used with a non-waiting block (e.g. Drive) in order to check the sensor condition.
  • Identify that the <Pressing bumper> block reports a TRUE or FALSE value in a [Wait until] block.
  • Identify how the [Drive for] and [Turn for] blocks are special blocks that can be either waiting or non-waiting.
  • Describe how to create a project that has a VR Robot drive forward until the Bumper Sensor is pressed.

Name and Save the Project

  • Start a new project in VEXcode VR and name the project Unit4Lesson2.
Why was the [drive] block used instead of the [drive for] block in this project?

[Wait until] Blocks

The [Wait until] block is a Control block that accepts Boolean conditions. [Wait until] blocks repeatedly check a Boolean condition and control the project flow. A project will not move to the next block in the stack until the condition in the [Wait until] block reports as TRUE. The [Wait until] blocks are used in conjunction with non-waiting blocks such as [Drive] or [Turn].

For Your Information

Non-waiting and waiting blocks determine when the next block begins a behavior. Waiting blocks, like [Drive for] and [Turn for], complete their behaviors before moving onto the next block in the stack. Non-waiting blocks, such as [Drive] and [Turn], continue to move to the next block in the stack even if the behavior of the non-waiting block is not complete.

Certain blocks, like [Drive for] and [Turn for] can be waiting or non-waiting blocks. Selecting the arrow on the block will turn the block from waiting into a non-waiting block.

Why was the [drive] block used instead of the [drive for] block in this project?
Why was the [drive] block used instead of the [drive for] block in this project?

  • Drag the [Drive] non-waiting block into the workspace.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • Attach a [Wait until] block beneath the [Drive] block.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • The [Wait until] block accepts Boolean conditions. This project will use the Bumper Sensor to drive through the Wall Maze Playground. Drag the <Pressing bumper> Boolean block into the [Wait until] block.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • Drag in a [Stop driving] block and add it to the project.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • Launch the Wall Maze Playground if it is not already open and run the project.
  • Watch the VR Robot drive from the start of the Wall Maze and stop when the Bumper Sensor is pressed by the wall.
  • The [Drive] block allows the VR Robot to keep driving forward while checking the condition of the Bumper Sensor with the <Pressing bumper> block. Once the <Pressing bumper> reports as TRUE, the VR Robot will move to the next block in the stack and stop driving.
    Why was the [drive] block used instead of the [drive for] block in this project?

    For Your Information

    To follow a visualization of waiting versus non-waiting blocks, watch the code execution highlighting function in VEXcode VR. At the beginning of this project, the green highlight will appear around the [Wait until] block until the condition is met. This is because the [Wait until] block is a waiting block. The green highlight will appear to skip the non-waiting blocks because these commands are quickly executed.

    Why was the [drive] block used instead of the [drive for] block in this project?

  • Start the project.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • The VR Robot will collide with the center castle and knock parts of it over.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • Select the “Reset” button to reset the Playground.
    Why was the [drive] block used instead of the [drive for] block in this project?

    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.”
    Why was the [drive] block used instead of the [drive for] block in this project?
  • 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.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • Select the “Start” button and run the project.
    Why was the [drive] block used instead of the [drive for] block in this project?
  • The VR Robot will move forward and backward for 800 millimeters (mm), returning to the starting position.
    Why was the [drive] block used instead of the [drive for] block in this project?

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.

Why was the [drive] block used instead of the [drive for] block in this project?

Save Your Project

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

Why was the [drive] block used instead of the [drive for] block in this project?

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