Using Bumper Switch with VEX EXP

Description

This sensor is a switch. It tells the robot whether its bumper is pressed (sensor value of 1) or released (sensor value of 0).

EXP_Bumper.png


How the Bumper Switch Works: Completing the Circuit

The VEX Bumper Switch is based on probably the most commonly used electrical device: the switch. A switch consists of two terminals (places to attach a wire) and a wire bridge to 'make' the connection when the switch is pressed. As in the illustration, when you press on the connecting wire, you 'complete' the circuit, and the Robot Brain registers that in your program.

The Bumper Switch is a part of a circuit which is unconnected, or broken. When you press the Bumper Switch, the connection is made, and electricity is allowed to flow.


Setup of the Bumper Switch

Placement

EXP_BaseBot_With_Bumper.png

The placement of the Bumper Switch is very important to obtaining accurate readings.

Be sure no structure on the robot is in front of the button on the face of the sensor.

There needs to be a clear path in front of the sensor between any object being pressed against and the sensor.

Reading Bumper Switch Results

Screen_Shot_2022-01-27_at_12.03.37_PM.png

It is helpful to use the print blocks to print the results of the Bumper Switch.

Once you create and run a project that prints Bumper Switch results, you will be able to see them on the Brain's screen.


Adding the Bumper Switch as a Device in VEXcode EXP

Whenever a sensor is used with a programming language, it needs to be configured within that language.

3-Wire_Devices.png

With VEXcode EXP, this is accomplished by using the ‘Add a device’ feature from the Devices window. You will need to go to the 3-Wire sensors.

3-Wire_Bumper.png

In the 3-Wire section of Devices you will find the Bumper Switch

To add the Bumper Switch to the configuration, follow the steps in this article.

Bumper_Switch.png

Once the Bumper Switch has been added to your project, a new set of sensor blocks will become available.

For more information on the blocks from the ‘Sensing’ category pertaining to the Bumper Switch, view the Help information (Blocks project).


Common Uses of the Bumper Switch

Sensing a Press

Screen_Shot_2022-01-27_at_12.28.33_PM.png

This feature allows your robot to detect when something presses on the Bumper Switch.

The example project shown on the left is used to code a robot with a Bumper Switch mounted on the front to drive until the sensor is pressed, and then stop driving once the Bumper Switch has been pressed.

Bumper Events

Screen_Shot_2022-01-27_at_1.50.07_PM.png

This feature allows your program to run specific code when detecting something pressing on the Bumper Switch.

The example project shown on the left is used to code a robot with a Bumper Switch mounted on the front to drive in a square, and anytime the Bumper Switch is pressed the Brain will print True.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: