Bumper#

Introduction#

The VEX IQ (2nd Gen) Bumper Sensing category offers methods for interacting with the Bumper Switch.

For the examples below, the configured Bumper Switch will be named Bumper1 and will be used in all subsequent examples throughout this API documentation when referring to bumper class methods.

Below is a list of all available methods:

Actions – Interact with the Bumper Switch.

  • pressed – Calls a function when the Bumper Switch is pressed.

  • released – Calls a function when the Bumper Switch is released.

Getters – Return data from the Bumper Switch.

  • pressing – Returns whether the Bumper Switch is being pressed.

  • installed – Whether the Bumper Switch is connected to the Brain.

Constructors – Manually initialize a Bumper Switch.

  • bumper – Create a Bumper Switch.

Actions#

pressed#

pressed calls a function when the bumper switch is pressed.

Usage:
Bumper1.pressed(callback);

Parameter

Description

callback

A function that is previously defined to execute when the Bumper Switch is pressed.

// Example coming soon

released#

released calls a function when the bumper switch is released.

Usage:
Bumper1.released(callback);

Parameter

Description

callback

A function that is previously defined to execute when the Bumper Switch is released.

// Example coming soon

Getters#

pressing#

pressing returns a Boolean indicating whether the Bumper Switch is currently being pressed.

  • 1 - The Bumper Switch is being pressed.

  • 0 - The Bumper Switch is not being pressed.

Usage:
Bumper1.pressing()

Parameters

Description

This method has no parameters.

// Example coming soon

installed#

installed returns a Boolean indicating whether the Bumper Switch is currently connected to the Brain.

  • 1 – The Bumper Switch is connected to the Brain.

  • 0 – The Bumper Switch is not connected to the Brain.

Usage:
Bumper1.installed()

Parameters

Description

This method has no parameters.

// Example coming soon

Constructors#

bumper#

bumper creates an object of the bumper Class in the specified port.

Usage:
bumper Bumper1 = bumper(port);

Parameter

Description

port

Which Smart Port that the Bumper Switch is connected to as PORT followed by the port number, ranging from 1 to 12.

// Example coming soon