How to code robot in VEXcode V5 Text to move forward and backward using driver control

Hello. I have a problem coding my robot to move forward and backward using the joysticks on my controller. I’ve been trying to find examples of code, but all of them for autonomous, not driver control. Can anyone help me out?

iq not have v5

This is what I have been using
//Drive Control
//Set the left and right motor to spin forward using the controller Axis values as the velocity value.
FrontLeftDr.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
BackLeftDr.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
FrontRightDr.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
BackRightDr.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);

Just ask if you want the whole code

I’m new to this and I can’t find many examples for driver mode, you can provide me with the code

Switch the DriveMotorA and DriveMotorB for your two motors

DriveMotorA.spin ( directionType::fwd, (Controller1.Axis4.value() + Controller1.Axis3.value())/2, velocityUnits::pct);
DriveMotorB.spin ( directionType::fwd, (Controller1.Axis4.value() - Controller1.Axis3.value())/2, velocityUnits::pct);
the /2 is for 50% speed which is what I have currently

I am starting out with v5 text also if anyone else could help me because I am in the same boat you are noob164

If you open the Vexcode V5 Text environment and go to File then Open Examples, a window will pop up with a whole bunch of example programs. If you scroll down to the section called Sensing, there are multiple programs to use either the left joystick, the right joystick, or a tank drive. They are commented well to help you understand what they are doing. Although there are many ways to accomplish these tasks, these should help you get started and understand how to make it drive.

4 Likes

If you are a new programmer (or builder), there is a whole wiki on Vexforum that will give you a lot of information. Here is the link: Wiki

3 Likes