Accelerometer#
The Accelerometer measures the acceleration of the robot along one or more axes. The sensor outputs an analog voltage that changes based on acceleration in G-forces (G).
A jumper on the Accelerometer determines its sensitivity range:
2G – Measures acceleration from -2G to +2G
6G – Measures acceleration from -6G to +6G

This page uses accel_a as the example Accelerometer name. Replace it with your own configured name as needed.
Below is a list of available methods:
acceleration– Returns the acceleration detected by the Accelerometer in Gs.changed– Registers a function to be called whenever the Accelerometer’s value changes.
Constructor – Manually initialize and configure an Accelerometer.
Accelerometer– Create an Accelerometer.
acceleration#
acceleration returns the acceleration value from which axis is connected on the Accelerometer as a float.
Usage:
accel_a.acceleration()
Parameters |
Description |
|---|---|
This method has no parameters. |
changed#
changed registers a function to be called whenever the Accelerometer’s value changes.
Usage:
accel_a.changed(callback, arg)
Parameters |
Description |
|---|---|
|
A previously defined function that executes when the Accelerometer’s value changes. |
|
Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information. |
def my_function():
brain.screen.print("Value changed")
# Call my_function whenever accel_a's value changes
accel_a.changed(my_function)
Constructor#
Constructors are used to manually create Accelerometer objects, which are necessary for configuring an Accelerometer outside of VEXcode.
Accelerometer#
Accelerometer creates an Accelerometer.
Usage:
Accelerometer(port, sensitivity)
Parameter |
Description |
|---|---|
|
The 3-Wire Port that the Accelerometer is connected to:
|
|
Optional. Whether to enable high sensitivity mode on the Accelerometer:
|
# Create a high sensitivity Accelerometer in Port A
accel_a = Accelerometer(brain.three_wire_port.a, True)