Coding with the VEX GO Brain

The VEX GO Brain is used to detect acceleration and rotation.

Battery with its connection cable plugged into the Battery Port on a Brain.

Note: in this article, the example projects use the Code Base GO Build.


How the Brain is Used

Close up view of the Brain to highlight its design and built in Gyro and Accelerometer.

The Brain has a built in Gyro and Accelerometer. These are used to detect acceleration and rotation.

The Brain can detect:

VEXcode GO Acceleration of block that reads acceleration of x axis. The block's dropdown menu is open to demonstrate that the measured axis can be changed to x, y, or z.

Acceleration.
The Brain can report acceleration of each of the three axes using the (Acceleration of) block.

Diagram of the Brain with the x, y, and z-axis indicated by colored arrows. When viewing the Brain from above and to the side with the Eye and Battery Ports facing towards you, the positive Z axis is down, the positive Y axis is to the left, and the positive X axis is pointing towards you.

The Brain reports acceleration on three axes. The x, y, and z-axis. Each axis has a positive and negative direction.

VEXcode GO Drive heading block that reads Drive heading in degrees.

Heading and Rotation.
The Brain can report the heading value in degrees using the (Drive heading) block.

Top down diagram of the Brain with a circle and degree units marked around it, indicating that the heading of the Brain can range from 0 to 359.99 degrees.

The heading value reports a range from 0-359.99 degrees. The value is reported from a clockwise turn.

VEXcode GO Drive rotation block that reads Drive rotation in degrees.

The Brain can report the rotation value in degrees using the (Drive rotation) block.

Top down diagram of the Brain with two arrows marked on either side of it indicating rotation. The arrow pointing clockwise is labeled as 'Rotation Increasing', and the arrow pointing counter clockwise is labeled as 'Rotation Decreasing'.

The rotation value reports positive values when rotated to the right, and negative values when rotated to the left. Rotation values are cumulative, and are not capped at 0 or 360 degrees. They will continue to increase or decrease as the rotations accumulate.


Report Acceleration Example Project

VEXcode GO blocks project that uses a Forever block with Looks blocks to print the x, y, and z acceleration of the Brain every 0.25 seconds.

The code below will report the acceleration value of each axis as the Code Base is rotated.

VEXcode GO with the Print Console menu opened and highlighted. The previous project has been run and the x, y, and z acceleration values have been printed to the Console.

The Print Console can be used to see the acceleration value changing in real time.


Report Heading and Rotation Example Project

VEXcode GO blocks project that reports the Drive heading and Drive rotation values as the robot turns right using a Repeat block. First, the project uses a Set drive heading block and a Set drive rotation block and sets them both to 0 as a default. Next is a Repeat block set to repeat 8 times, with a Turn right for 90 degrees block and then Print blocks to print the current heading and rotation values. At the end of the Repeat block there is a Wait 1 second block to ensure that the robot has enough time to turn.

The code below will report the heading of the Code Base’s Drivetrain and the rotation value as the Code Base turns.

VEXcode GO with the Print Console menu opened and highlighted. The previous project has been run, and the Heading and Rotation values have been printed to the Console as the robot turned to the right.

The Print Console can be used to see the heading and rotation values changing in real time.

Notice that the heading values are reported clockwise between 0-359.99 degrees, because the Code Base is turning right. Rotation values are cumulative, they will continue to increase (right rotation) or decrease (left rotation).

The previous VEXcode GO block project that has been changed to turn left instead of right. First, the project uses a Set drive heading block and a Set drive rotation block and sets them both to 0 as a default. Next is a Repeat block set to repeat 8 times, with a Turn left for 90 degrees block and then Print blocks to print the current heading and rotation values. At the end of the Repeat block there is a Wait 1 second block to ensure that the robot has enough time to turn.

Adjust the [Turn for] block in the project to change the direction from ‘right’ to ‘left’ and Start the project again.

VEXcode GO with the Print Console menu opened and highlighted. The previous project has been run, and the Heading and Rotation values have been printed to the Console as the robot turned to the left.

In the Print Console, notice that the heading values are reported clockwise between 0-359.99 degrees, because the Code Base is turning left. The first turn left 90 degrees is reported as a heading of 270 degrees. The rotation values continue to increase with each rotation, however, since the Code Base is turning left, the rotation values are reporting negative.

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

Last Updated: