Accelerometer Sensing#
To make Accelerometer Sensor blocks appear in VEXcode V5, a 3-Wire Accelerometer Sensor must be configured in the Devices window.
For more information, refer to these articles:
Accelerometer Acceleration#
The Accelerometer Acceleration block is used to report the acceleration value from one axis on the Analog Accelerometer.
VEXcode blocks stack of code containing a Accel2g3g acceleration in g block.#
([Accel2G3G v] acceleration in g)
The Accelerometer Acceleration block reports a range from -2.0 G to 2.0 G or -6.0 G to 6.0 G depending upon the jumper setting on the Analog Accelerometer.
Choose which Accelerometer to use.
In this example, the Drivetrain will drive forward for 1 second before its current acceleration is printed on the Brain’s screen.
VEXcode blocks stack of code containing a when started block, a drive forward block, a wait 1 second block, a print Accel2g3g acceleration in g on Brain and set cursor to next row block.#
when started :: hat events
[Drive forward for 1 second.]
drive [forward v]
wait (1) seconds
[Print the current acceleration after 1 second.]
print ([Accel2G3G v] acceleration in g) on [Brain v] ◀ and set cursor to next row