VCS Example Program with Controller - Modkit - Claw and Arm

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


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

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.