Skip to main content

Programming the Robot Arm - Blocks-based

The V5 Clawbot is ready to reach!


This exploration will give you the tools to be able to start creating some cool projects that use the V5 Clawbot's arm.

  • VEXcode V5 that will be used in this exploration include:

VEXcode V5 block reads: spin ArmMotor up for 90 degrees.

  • To find out more information about the block, open the Help and then select the [Spin for] block.

VEXcode V5 showing the Spin for block in the workspace on the left and the Help open to the right. The Help reads that the Spin for block spins a V5 Smart Motor for a given distance, and gives information about how to use the block in a project.

  • Make sure you have the hardware required, your engineering notebook, and VEXcode V5 downloaded and ready.
Materials Required:
Quantity Materials Needed
1

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

1

VEXcode V5

1

Engineering Notebook

1

Clawbot and Advanced TrainingBot (Drivetrain 2-motor, No Gyro) example project

Step 1:  Preparing for the Exploration

Before you begin the activity, do you have each of these items ready? Check each of the following:

  • Are the motors plugged into the correct ports?

  • Are the smart cables fully inserted into all of the motors?

  • Is the Brain turned on?

  • Is the battery charged?

Step 2: Start a New Project

Before you begin your project, select the correct template project. The Clawbot and Advanced TrainingBot (Drivetrain 2-motor, No Gyro) template example project contains the Clawbot's motors configuration. If the template is not used, your robot will not run the project correctly.

VEXcode V5 Toolbar with the File menu open and Open Examples highlighted in a red box. Open Examples is the fourth item in the menu beneath New Blocks Project, New Text Project, and Open.

Complete the following steps:

  • Open the File menu.
  • Select Open Examples.

Icon that reads Clawbot and Advanced TrainingBot (Drivetrain 2-motor, No Gyro) with a gray robot above the text.

  • Select and open the Clawbot and Advanced TrainingBot (Drivetrain 2-motor, No Gyro) template example project.
  • Since we will be programming to control the arm, rename your project ArmControl.
  • Save your project.
  • Check to make sure the project name ArmControl is now in the window in the center of the toolbar.

The Project name dialog box in the VEXcode V5 Toolbar reads Arm Control. Slot 1 is selected and the Toolbar reads Saved to the right.

Step 3: Move the Arm Up

We are now going to begin by programming the arm to raise!

Spin for block reads: spin ArmMotor up for 90 degrees.

  • Add the [Spin for] block below the {When started} block in the programming area.

VEXcode V5 Toolbar with Tutorials highlighted in a red box. The Toolbar shows, from left to right, the V5 logo, a globe icon, File, and Tutorials. To the right of Tutorials are additional icons and functionality.

  • Watch the Moving the Arm Tutorial in VEXcode V5 if you would like a demonstration.

Slot selection in the VEXcode V5 Toolbar, with slot 1 selected and highlighted with a red box.

  • Click on the Slot icon. You can download your project to one of the available slots in the Robot Brain. Click on Slot 1.

Brain icon shows green in the VEXcode V5 Toolbar, to the right of a disabled Controller icon, and to the right of the Download icon. The Brain icon is highlighted with a red box.

  • Connect the robot to your computer or tablet. The Brain icon in the toolbar turns green after a successful connection has been made.

The Download button in the VEXcode V5 Toolbar is highlighted with a red box. The Download icon is to the right of a green Brain icon and to the left of the Run button.

  • Click the Download button on the toolbar to download the Drive project to the Robot Brain.

V5 Brain Home screen shows the Arm Control project in slot one in the lower left corner. The row of icons above it read Drive, Devices, Settings, and a VEX folder.

  • Check that the ArmControl project has downloaded to the brain in the slot you chose.
  • Run the project on the Clawbot by making sure the project is selected and then press the Run button. Congratulations on creating your first Claw Arm project!

Step 4: Try This: Program the Arm Down

Now that you have programmed the arm to move up, you will now program the arm to lower or move down.

Sideview of the V5 Clawbot with the claw facing to the right.

The V5 Clawbot with its arm down.

  • Add a [Wait] block and a second [Spin for] block to your ArmControl project so that the arm raises to 90 degrees, waits 3 seconds, and then returns back down.
    Hint: You will need to change the direction within the [Spin for] block. For more information about the [Wait] block, see VEXcode V5 Help feature.
  • Test that your revised project moves the arm up for 90 degrees, waits three seconds, and then moves the arm down for 90 degrees by downloading and running your ArmControl project.
  • Notice that the arm holds its position while the  [Wait] block is running. The motor draws power from the battery to hold the arm up against the force of gravity. That's because the default setting for having the motor stop is the <Hold> setting. There are two other settings for stopping - <Brake> and <Coast>. You will learn about those in another lab.

Step 5: Complete the Flight Traffic Controller Challenge

Side view of the V5 Clawbot with the arm extended upwards and two arrows pointing up and down below the claw, indicating up and down motion.

A V5 Clawbot raising and lowering its arm.In the Flight Traffic Controller Challenge, the Clawbot must move its arm up and down each for 90 degrees, wait 3 seconds, move the arm up and down twice each for 45 degrees twice, wait 5 seconds, and then move the arm up and down three times for 90 degrees.

Here is a list of the Clawbot's behaviors:

  • Move arm up and then down for 90 degrees.
  • Wait 3 seconds.
  • Move arm up and then down for 45 degrees.
  • Move arm up and then down for 45 degrees.
  • Wait 5 seconds.
  • Move arm up and then down for 90 degrees.
  • Move arm up and then down for 90 degrees.
  • Move arm up and then down for 90 degrees.