Motor Joystick Programming - unofficial reply

Most forum users cannot answer this question in the official forums, so I’m answering for you here.

The root cause of you problem is sending more than one value to some of the motors each time around the main loop. For example;

motor[port5]=vexRT[Ch6];// set the motor, 'arm motorright' to the right-hand rear buttons.
if(vexRT[Btn6U] == 1) // if Btn6U is pressed:
{motor[port5]=127;}
else
{motor[port5]=0;}
if(vexRT[Btn6D] == 1) // if Btn6D is pressed:
{motor[port5]=-127;}
else
{motor[port5]=0;}

Lets format the code a little first to make it clearer.

motor[port5]=vexRT[Ch6];// set the motor, 'arm motorright' to the right-hand rear buttons.

if(vexRT[Btn6U] == 1) // if Btn6U is pressed:
    {
    motor[port5]=127;
    }
else
    {
    motor[port5]=0;
    }
if(vexRT[Btn6D] == 1) // if Btn6D is pressed:
    {
    motor[port5]=-127;
    }
else
    {
    motor[port5]=0;
    }

You are controlling the motor on port 5 from three different places, joystick channel 6 (??, is this a crystal controller?), button 6U and 6D. You can have situations with code like this where one button may be pressed and the value 127 sent to the motor, but the other isn’t and that will cause the value 0 to be sent.

See this thread for more in depth discussion.

Stop your motors jittering

1 Like

This is not a crystal controller, but a VEX joystick controller. I was trying to lift and lower an arm, but the arm jitters when it lowers. Thanks, for the code to stop the jittering. This is my first time using the VEX 2.0 code language, I usually use the PLTW Natural Language.
Katelyn
Team 184