Limit Motor Speed for Joystick

Hello everyone, It would help if you could show me how to do so

thank you in advance

What is your current code?

FrontLeft.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);
BackLeft.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);
FrontRight.spin(vex::directionType::fwd, Controller1.Axis2.position() , vex::velocityUnits::pct);
BackRight.spin(vex::directionType::fwd, Controller1.Axis2.position(), vex::velocityUnits::pct);

this is the code that I need to add motor limits to

Code to make your robot 75%slower

FrontLeft.spin(vex::directionType::fwd, (Controller1.Axis3.position()*0.75, vex::velocityUnits::pct);
BackLeft.spin(vex::directionType::fwd, (Controller1.Axis3.position()*0.75), vex::velocityUnits::pct);
FrontRight.spin(vex::directionType::fwd, (Controller1.Axis2.position()*0.75) , vex::velocityUnits::pct);
BackRight.spin(vex::directionType::fwd, (Controller1.Axis2.position()*0.75), vex::velocityUnits::pct);

Motor.spin(vex::directionType::fwd (Controller1.Axis[insert axis number] .position()*[number from 0 to 1, that controals how much slower. 0 is no movement, 1 is max speed]), vex::velocityUnits::pct);

Use above code, replacing things in [ and ]

1 Like

thank you for the help,

1 Like

For some reason, when I copy pasted the code you gave me, it told me that there were expected parentheses and that the .spin does not work or something

The code he posted had a missing parentheses after 0.75 for the FrontLeft motor


Sorry. Typing on a phone, in a rush. I deeply apologize for that.

1 Like