VCS Example Program with Controller - Modkit - Claw and Arm

Get more with VEXcode
We recommend you transition to our new software. VEXcode has both block-based and text-based options, that work on Chromebooks, iPads, Android tablets, Windows and Macs. Visit code.vex.com for more details on how to download VEXcode.
VEX Coding studio has been discontinued and is no longer available for download. Already downloaded? The program will continue to function but will no longer be supported.
Users who transition to VEXcode can migrate their C++/C++ Pro projects to VEXcode Text by following this article.

This example program shows how to program the arm and claw motors of the V5 Clawbot using the V5 Controller.

ArcadeControl.vex

Configuration
  • A V5 Smart Motor, on Port 3, named clawMotor.
  • A V5 Smart Motor, on Port 8, named armMotor.
Program

How it works

First, the  when (STARTED) block tells the robot to run this code when the program starts.

Next, the claw motor and arm motor are set to  .setStopping.  .setStopping is a condition in which the motor will firmly hold, or lock in to, its position.

Then, the program will pause for two-tenths of a second ( .2 seconds).

The following actions can occur based upon which button you choose to press:

When controller button L1 is pressed, the claw motor will  .spin(forward), causing the claw to close.

When controller button L2 is pressed, the claw motor will  .spin(reverse), causing the claw to open.

When the controller buttons L1 and/or L2 are released, the claw motor will  stop.

When controller button R1 is pressed, the arm motor will  .spin(forward), causing the arm to lift.

When controller button R2 is pressed, the arm motor will  .spin(reverse), causing the arm to lower.

When the controller buttons R1 and/or R2 are released, the claw motor will  stop.