How do I Program an Xdrive on vex code

I need help with programing an drive for my team and I don’t know where to start. If some one could help me I would really appreciate the help.

The same way you program an X drive on robotc, only this time you are setting the velocity with a function instead of a variable.

3 Likes

Hi Error101,

I would check out this video. Start at about 0:40 for the programming part. This video really helped me to understand an X drive. Although it is in ROBOTC with the cortex system, it should translate over to vexcode pretty well

1 Like

Do you have an example of any vexcode x drive code I’m not the best at vexcode as this is my first year

It’s al right if you don’t though

Basically, you would just want to say

while(true){
/keeps this code always repeating

LeftFront.spin(forward);
/keeps the motor always "on"
LeftFront.setVelocity(Controller1.Axis2.position()+Controller1.Axis1.position()+Controller1.Axis4.position(), percent);
//Sets the motor speed

 //Do this for all motors with the equations shown in the video
 }
3 Likes

Thank you so much all

You could replace the

with

LeftFront.spin(forward,Controller1.Axis2.position()+Controller1.Axis1.position()+Controller1.Axis4.position(), percent);

To make it less confusing.

1 Like