V5 Controller Programming

Maybe I tagged this wrong. :man_shrugging:

I need to be able to set motor value to partial power of the V5 joystick (e.g. - joystick/2). What does this look like in VCS C++? I can’t find any sample code to use for guidance. Thanks!

a good example is looking at the controller example codes, they take half the value of the joysticks for the control

In VCS,the splash screen has a tab labeled Example Projects. Click there and then controller, and you will have some options to get you started.

I looked there, but the two programs don’t show the scenario I’m looking for.

From the tank drive example code:

        //Drive Control
        //Set the left and right motor to spin forward using the controller Axis values as the velocity value.
        LeftMotor.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
        RightMotor.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);

The part of that line that is the controller signal is

       Controller1.Axis3.value(),  

If you want to modify that value mathematically, do so before the comma. i.e.:

       Controller1.Axis3.value() / 2,  

perfect. I did it right after the word “value”. Just had the wrong placement. Thanks!

i want to ask , can i use robotc program to copy to VCS ???

Can i use robotc program to copy to VCS ???

how to set to controller , and what different for VCS and Robotc ???

No, RobotC has totally different function calls than VCS. You can look at it as pseudocode for VCS, but not something to directly copy.

VCS uses C++, while RobotC mostly uses C. Their libraries for VEX-specific commands are totally different.