how do you make 2 motors run at the same time on the same line

If you’re using ROBOTC you do something like this (Someone correct me if I’m wrong):

motor[Motor1] = motor[Motor2] = 127;

I am using the new program language



both PROS and VCS can code in c++

Identify your programming language from this list (also linked in my signature):

PROS, VCS, and Robot Mesh Studio all have C++ implementations. For VCS and RMS C++, you have to do two separate statements:

motor1.spin(vex::directionType::fwd, yourVelocityDoubleHere, vex::velocityUnits::pct);
motor2.spin(vex::directionType::fwd, yourVelocityDoubleHere, vex::velocityUnits::pct);

You could also encapsulate these in a function so that you could do a single statement elsewhere:

void bothForward (double velocity) {
    motor1.spin(vex::directionType::fwd, velocity, vex::velocityUnits::pct);
    motor2.spin(vex::directionType::fwd, velocity, vex::velocityUnits::pct);

You could then simply call that function instead of writing out both lines out by hand:


Robot Mesh Studio actually has a class specifically for doing this:


. We made it specifically for the purpose of helping 2-motor drive trains do forward/reverse and turning commands in a simple manner. Here’s an example of it in use for a simple autonomous program: link.