userControl problem

88D8B671-98AB-436b-8DB1-F28FA8396EDA

How can I modify the code to achieve the same forward speed and slower turning speed?

Note: Unofficial Response
Whenever you request a “value()” of the controller axis, you ultimately receive a number. The axis for turning is likely Axis 1 as depicted on the VEX controller, so just do

Controller1.Axis1.Value()/1.5

within the parenthesis.

It seems like you are relatively new to coding. I would highly advise looking through tutorial videos and instruction videos displayed on the VEX Robotics website or within the VEXCode via File → Open Tutorials, or searching YouTube.
If you wanted to make the code more organized, I would suggest doing:


double turningMultiplier = 0.75;
double forwardMultiplier = 1;


void usercontrol(void) {
  // User control code here, inside the loop
  while (1) {
    double forwardControllerValue = Controller1.Axis3.value();
    double turningControllerValue = Controller1.Axis3.value();

    L1.spin(forward, forwardControllerValue * forwardMultiplier + turningControllerValue * turningMultiplier, percent);
    R1.spin(forward, forwardControllerValue * forwardMultiplier - turningControllerValue * turningMultiplier, percent);
    L2.spin(forward, forwardControllerValue * forwardMultiplier + turningControllerValue * turningMultiplier, percent);
    R2.spin(forward, forwardControllerValue * forwardMultiplier - turningControllerValue * turningMultiplier, percent);

    wait(10, msec); // Sleep the task for a short amount of time to
                    // prevent wasted resources.
  }
}
1 Like

you don’t actually have to indicate this. Its the vex forum, not the Q&A.

1 Like

The category is “Official Tech Support”
As non-official individuals can make posts here, I add that disclaimer to inform the thread owner that my response is not a response affiliated with an official VEX Tech Support person.

1 Like

This post was flagged by the community and is temporarily hidden.

3 Likes