Using the Bumper Sensor in VEXcode VR

The VEXcode VR Robot has two Bumper Sensors. The Bumper Sensor can be used with VEXcode VR to report if a Bumper Sensor is pressed on the VEXcode VR Robot.

The following article will cover:


What is a Bumper Sensor?

VEXcode VR Bumper Callout

A Bumper Sensor is a switch. The Bumper Sensor reports if it is pressed or released.

  • The Bumper Sensor will report a sensor value of 1 when the bumper sensor is being pressed.
  • The Bumper Sensor will report a sensor value of 0 when the bumper sensor is released.

Dashboard bumper

The Bumper Sensor’s value can be viewed in the Dashboard. For more information about the Dashboard, check out the VEXcode VR Dashboard Article.


Common Uses of a Bumper Sensor

Bumper maze wall

The Bumper Sensor can be pressed by walls in the Wall Maze Playground.

Playground walls

The Bumper Sensor can also be pressed by walls surrounding different Playgrounds.


Where do I find the Pressing Bumper block?

VR Main Screen

To begin programming the Bumper Sensor, you will need to first open VEXcode VR. For more information, check out the Launch - Get Started with VEXcode VR article.

Sensing category

Next, locate the Sensing category in the Tool box and find the Pressing Bumper block.


How would I program the Bumper Sensor?

Change the Bumper Sensor

Left_Right_Bumper_Block.png

You can select the Left Bumper or Right Bumper from the drop-down menu.

Boolean blocks

Example Program

The Boolean blocks report a condition as either true or false and fits inside any blocks with hexagonal (six-sided) inputs for other blocks.The Pressing Bumper Boolean block reports “true” if the bumper is pressed and “false” if the bumper is released or not pressed. For more information about Boolean blocks visit the Help or the Block Shapes and Meaning - VEXcode VR article.

The following is an example of a code that will cause the VR Robot to drive forward until it bumps into an object or wall.

C blocks

Example Program

C blocks loop the block(s) within them or check if a condition is true or false. They are shaped to attach stack blocks above, below, or inside them. The Bumper Sensor control blocks are commonly used with conditionals (C blocks), such as the if then or wait until blocks. For more information about conditional blocks found in the Control category, visit the Help or the Block Shapes and Meaning - VEXcode VR article.

In the following example, the code will cause the VR Robot to drive in a square forever.