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).
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
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
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.
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.
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.
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
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
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.