How do you program a 6 motor drivetrain

We have been wanting to implement a 6 motor drivetrain for a long time but have been lacking the knowledge to carry it out. Normally we would just set up the drivetrain by using the configuration tab but there is no base configuration for a six motor drivetrain.

(All edits are for grammar corrections and inserting images)
For VEXcodeV5 PRO you have to make all the motors present in the side tab. For it to go one speed do something like

function Drive_Forwards {
Motor2. spin(forwards)
Motor3. spin(forwards)
Motor4. spin(forwards)
Motor5. spin(forwards)
Motor6. spin(forwards)
Function Stop_Drive {
If (joystick-value2>=30) {
Drive_forwards ()
Else () {
Stop_Drive ()
To go backwards, revert the 30 to a -30
For multiple speeds, that takes a while and using functions takes more time then direct coding.
I can give a demonstration picture in like 2 hours (I did that all from memory)
also DO NOT COPY THIS CODE it probably wont work, its just for the idea. Good luck, more to come in 2 hours

If programming in VEXcode Blocks, you’re out of luck – there is no way to set up a drivetrain object with more than 2 motors on each side.

But in text (either in VEXcode or VEXcode Pro), you can initialize a drivetrain object with as many motors as you want on each side by first creating a motor_group for each side of the drive – for example:

const int wheelTravel = 320;
const int trackWidth = 320;
const int wheelBase = 130;
motor_group driveL(Motor1, Motor2, Motor3);
motor_group driveR(Motor4, Motor5, Motor6);
drivetrain myDrivetrain(driveL, driveR, wheelTravel, trackWidth, wheelBase, mm);

Looks like I’ve been doing it the hard way

@holbrook does this setting have more than 3 speeds? I need to know if I should switch or not

I’m not sure what you mean by “more than 3 speeds” but the snippet above is initializing the same drivetrain object that you can get in the graphical setup menu.

After setting up the drivetrain, is there a good way to control it with a controller?

The general approach is to have an infinite loop in the usercontrol function which reads the values of several joystick axes, does some math to them, and applies the desired power level to the motors (or in this case, the motor groups) accordingly.

If you search on the fourm for terms like “tank drive” and “arcade drive”, you’ll get lots of threads with code examples.


In addition, the Examples and Tutorials in VexCode Pro include Tank and Arcade drive examples for a clawbot, which demonstrate the control-loop approach. On the internet:

I have seen teams wire up to the Controller’s Axis’ changed event. While one could award bonus points for thinking in event terms, this is generally not an appropriate case for using them.


Lord’s of the forums your help has been legendary and my gratitude is sincere.

By “more then 3 speeds” I mean does the joystick control the speed at intervals (and if so how many) or is it smooth (wherever you put the joystick that’s the speed the motors will go)