Opening the Claw#

Opening the Claw

This tutorial covers how to open the claw on your VEX IQ Clawbot in VEXcode IQ (2nd gen). By the end, you’ll have a project that opens the claw.

To use the claw on your VEX IQ Clawbot, first you need to configure the Clawbot in VEXcode. The easiest way to do this is to open a Clawbot template.

Go to the Devices tab, then select Select a build. If the Devices tab is not visible, see Navigating VEXcode.

Screenshot of the Devices tab, showing the Select a build button.

Scroll down and select the Clawbot build.

Screenshot of the Select a build screen, with the Clawbot build highlighted among other robot builds.

The build used for this tutorial is the Drivetrain, Claw Motor version of the Clawbot.

Screenshot of the Choose a variant for Clawbot screen, with the Drivetrain, Claw Motor variant highlighted.

Select Done to add this build to your project.

Screenshot of the Current Configuration screen for the Clawbot, Drivetrain, Claw Motor build, with the Done button highlighted.

Select the Motion category in the toolbox to find the Motion blocks, including the spin blocks for the ClawMotor.

Screenshot of the toolbox with the Motion category open, showing the spin ClawMotor blocks.

Attach the spin motor for block to the when started block.

The spin motor for block, spinning the ClawMotor.#
    spin [ClawMotor v] [close v] for (90) [degrees v] ▶

Change the direction parameter to open instead of close, and change the distance parameter to 60. This will open the robot’s claw 60 degrees from its current position.

When started, opens the claw 60 degrees from its current position.#
    when started
        spin [ClawMotor v] [open v] for (60) [degrees v] ▶

You can also change the units parameter to turns instead of degrees. One turn is equal to 360 degrees.

The spin motor for block, using turns instead of degrees.#
    spin [ClawMotor v] [open v] for (1) [turns v] ▶

One tip is to use the set motor timeout block before using the spin motor for block.

The set motor timeout block.#
    set [ClawMotor v] timeout to (1) seconds

If you accidentally set the spin motor for block to too great of a distance, the set motor timeout block will force it to end, and the project to move on, even if the motor hasn’t reached the position it wanted to.

When started, sets a 1 second timeout before opening the claw, so the project moves on even if the claw doesn’t reach its target position.#
    when started
        set [ClawMotor v] timeout to (1) seconds
        spin [ClawMotor v] [open v] for (600) [degrees v] ▶