VCS Example Program - Modkit - V5 Clawbot - 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 V5 Clawbot to open and close its claw using Modkit.

ObjectDelivery.vex

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

How it works

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

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

The arm motor is also set to to   .setStopping  which will lock the arm motor in to position.

The claw motor will then   .spin(forward), causing the claw to close.

Then, the program will pause for two-tenths of a second (  .2 seconds)  to allow the motor to start spinning.

Then the claw motor will be commanded to   stop .

Then, the program will pause for   1 second.

The arm motor is set to setTimeout after 5 seconds to ensure that when the arm's motion is resisted, the motor will stop.

The arm motor will then rotate   360 degrees (lifting).

Then, the program will pause for   1 second.

The left motor and right motor will work in conjunction and rotate forward   2160 degrees (or 6 rotations).

The program will then  .waituntil the motors complete the rotations and will pause for  1 second.

The arm motor will .rotate to   0 degrees, (dropping).

The program will pause for   1 second.

Then, the claw motor is set to   spin in reverse. Since spin is used, the motor will begin rotating and the program will continue immediately. Spinning in reverse causes the claw motor to open the claw jaws.

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

Then the claw motor will   stop .