Question

So I want to slow down a motor on a Tetrix Robot:

Here's my code:

//Makes the main frame of arm move up and down  

    motor[motorE] = joystick.joy1_y2 ;

How can I make the values given by joystick.joy1_y2slower?

Was it helpful?

Solution

I'm the programmer on an FTC Team and we use RobotC, like it appears you are using. If you are, you can just divide the joystick.joy1_y2 by some other value for instance:

motor[motorE] = (joystick.joy1_y2/2);

And you could make that adjustable by using something like:

int motorDivide = 1;

task motorTask;

task main(){

    StartTask(motorTask);

    while(true){
       getJoystickSettings(joystick);
    }

}

task motorTask(){
    while(true){

        if (joy1Btn(1) == 1){
            motorDivide+=1;
            if (motorDivide >= 3){
                motorDivide = 1;
            }
            wait1Msec(100);
        }

        motor[motorE] = (joystick.joy1_y2/motorDivide);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top