Skip to main content

The V5 Clawbot is ready to move!

You can use the Help information inside of VEXcode V5  to learn about the blocks. For guidance in using the Help feature, see the Using Help tutorial.

Materials Required:
Quantity Materials Needed
1

VEX V5 Classroom Starter Kit (with up-to-date firmware)

1

VEXcode V5 (latest version, Windows, MacOS, Chromebook)

1

Engineering Notebook

1

Using Loops (Tutorial)
 

1

Repeating Actions (No Gyro) example project
 

Step 1:  Let's start programming with loops.

  • Start by watching the Using Loops tutorial video.

  • Open the Repeating Actions (No Gyro) example project.

    Image of the Repeating Actions (No Gyro) example project in VEXcode V5

  • View the opened example project.

    A block-based coding sequence in VEXcode showing a program that drives a robot in a 300mm by 300mm square. The code includes a when started block, a repeat 4 block, and two commands inside the loop: drive forward for 300mm and turn right for 90 degrees. A yellow note on the right explains that the program drives the robot in a square by repeating the drive forward and turn commands four times

Do the following in your engineering notebook.

  1. Predict what the project will have the Clawbot do. Explain more than the fact that the project repeats.

    What is it repeating? What is the Clawbot doing?

  2. Write your prediction, but do not break the short project into more than two parts.
  • Save, download, and run the Repeating Actions (No Gyro) example project.

    Image showing the project name, Repeating Actions, in the Toolbar in VEXcode V5

  • For help, see the tutorial in VEXcode V5 that explains how to Download and Run a Project.

    Image of the Toolbar in VEXcode V5 with a red arrow pointing to the Tutorials icon

     

  • Check your explanations of the project in your engineering notebook and add notes to correct them as needed.

Step 2: Run the project and observe the robot.

A comparison of two block-based coding sequences in VEXcode. The left sequence uses sensor input to determine when to turn, with a forever loop that checks if the bumper sensor is pressed; if pressed, the robot turns right for 90 degrees, otherwise, it drives forward. The right sequence uses a fixed distance to determine when to turn, with a repeat 4 loop that drives the robot forward for 300mm and then turns right for 90 degrees

Look at the Repeating Actions (No Gyro) project (on the right) again. This project will repeat the forward and then turn behavior four times. A repeat block is used when you want to use a set of behaviors for a certain number of times. If the repeat block is replaced with a forever block, the robot would repeat the forward and then turn behaviors forever.

In the project on the left, a sensor's input is used to determine when to begin turning. The project on the right uses a fixed Drivetrain distance to determine when to begin turning.

In order to continually check a sensor's input, an if/else block is used together with a forever block. In the project on left, the robot will turn right when the BumperH sensor is pressed, otherwise the robot will drive forward forever if the BumperH sensor is not pressed. To continually check the BumperH sensor's value, the if/then block is within a forever block.

The above project on the left is a practical use-case of a structure that repeats forever - using forever blocks and if/then blocks together. Imagine a self-driving sweeper that continues to drive forward until it runs into a wall or object, then turns before continuing to drive.

Step 3: The Squared Loops Challenge!

A diagram showing a green square pathway with arrows indicating the direction of movement around the square. Additional orange arrows outside the square point in different directions, corresponding to the turns and movements required to follow the pathway.

  • Have your Clawbot drive in a square.
  • Before each turn, the claw must be opened and closed, and the arm must be raised and lowered.
  • The Clawbot cannot drive along a side of the square more than once.
  • You can use the Repeating Actions (No Gyro) example project as a starting point but save it as SquaredLoops before making any changes.

Image showing the Squared Loops project name in the VEXcode V5 Toolbar

In your engineering notebook, plan the following:

  • Plan out your solution and predict what each block in your project will have the Clawbot do.
  • Download and run your project to test it before submitting it.
  • Make changes to the project as needed and take notes about what was changed during testing.