Need help making a 6M DriveTrain

So I have a code written but can’t seem to get it to actually drive. Looking for some help on what to do from here.

// Include the V5 Library
#include "vex.h"
// Allows for easier use of the VEX Library
using namespace vex;

//All Motors

vex::motor RightFront = vex::motor( vex::PORT20, false);

vex::motor RightMiddle = vex::motor( vex::PORT19, false);

vex::motor RightBack = vex::motor( vex::PORT18, false);

vex::motor LeftFront = vex::motor( vex::PORT1, false);

vex::motor LeftMiddle = vex::motor( vex::PORT2, false);

vex::motor LeftBack = vex::motor( vex::PORT3, false);


vex::motor_group RightSide = vex::motor_group(RightFront, RightMiddle, RightBack);

vex::motor_group LeftSide = vex::motor_group(LeftFront, LeftMiddle, LeftBack);


const int wheelTravel = 12;

const int trackWidth = 16;

const int wheelBase = 16;

const double gearRatio = 4.2;


vex::drivetrain RoboDrive = vex::drivetrain(LeftSide, RightSide, wheelTravel, trackWidth, wheelBase, distanceUnits::in, gearRatio);


vex::controller Controller1 = vex::controller();

int main() {

bool ForwardDrive = Controller1.ButtonA.pressing();
if (ForwardDrive) {
1 Like

For tank drive make each motor group as a joystick (I am in school right now and cannot fully assist you).

The issue is that your drive code is only running once. You need it to be in a loop.

int main() {
  while (true) {
    if (Controller1.ButtonA.pressing()) {

But as @DesignChampion mentioned, you should probably put this on a joystick instead of a button.


If you are using tank drive controls (left joystick to left side, and vice versa), then use a forever loop to set each individual motor’s velocity in % to their joystick measurements. (left motors to left joystick’s vertical measurements, right motors to right joystick vertical measurements)
It’s a bit trickier with arcade controls(left joystick for forward and reverse, right joystick for turning) but it can be done with a forever loop setting each left motors velocity in % to the left joystick position plus right joystick horozontal position and each right motor’s velocity to the left joystick’s vertical measurement plus the right joystick’s horozontal measurement.
I am only semi-experienced in block code, no experience in text code so no idea if this helps.