How to Configure and Program Bumper Switches in VCS

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.

Step 1: Add two Bumper Switches to the robot configuration

  • Click, drag and drop two Bumper Switches from the list of smart devices into the user workspace.
  • Select Port A for the Bumper Switch on the right side and Port B for the switch on the left side.
  • Name the Bumper Switches as LeftBumper and RightBumper.

NOTE: A Bumper Switch v2 is a Three Wire Device.

NOTE: The configuration shown is for a V5 EDR Clawbot with two Bumper Switches on the C-Channel beam at the back of the robot. See this page for details.

Step 2: Begin a program

  • Click the Control command filter to access control commands and add a  when (STARTED)  command from the Control commands.
  • Add two  setVelocity  commands inside of the  when (STARTED)  command.
  • Set the Left Motor with a velocity of 25 percent and set the RightMotor with the same velocity.

NOTE: A  setVelocity  command is included under Settings commands.

Step 3: Add Actions commands

  • Add two spin commands below the setVelocity commands.
  • Set the first so that the Left Motor spins in reverse and the second so that the Right Motor spins in reverse.

NOTE: A  spin  command is included under Actions commands.

Step 4: Add a command so that the program waits until a condition is met

  • Add a waitUntil command from under the Control filter.
  • Add an and command from under the Operators filter, inside of the waitUntil command.
  • Insert two Bumper.pressing commands from under the Sensing filter inside of the and command.
  • Set the first  pressing   command to  RightBumper.pressing   and the second to  LeftBumper.pressing.  

Step 5: Set the commands to carry out when the condition is met

Add two stop commands from under the Actions filter.

  • Set one as the Left Motor and the other as the Right Motor.

NOTE: This program works best for stopping a V5 EDR Clawbot after it backs into a wide obstacle with a low wall or barrier.