Slowing Down Motor On Java

I am a new person to the world of java and i have stumbled on to a problem. When trying to program a prototype arm it goes to fast.::safety::

How can i reduce the speed without changing the arm itself?

Just divide the number you are sending to the set() function by some number greater than 1.

the code looks for a magnitude value from the controller that ranges from -1 to 1. like jhersh said, divide by some number.

2 would give half speed, for the best results if 2 is too large move the number by increments of .5

Are you using a Jaguar? A Victor? or a Spike?

Currently i am using a victor to control the arm system.

So based on what you said I am assuming you are doing something along this line

Victor a_motor = new Victor(1);
a_motor.set(1);

If you wanted to go slower you would want a percentage of the power so for example 25% power

Victor a_motor = new Victor(1);
a_motor.set(0.25);

okay yayyyy it worked so awesome…
but now i have a situation which is causing me a headache.:confused:

how can i control the motor, using the victor, going forward and reverse using different buttons on the joystick cause i need the arm to go up and down.

Thanks so much for your help people i really appreciate it. :smiley:

Set the value to a negative number for reverse direction

e.g. set (0.5) for 50% forward and set(-0.5) for 50% reverse

Thats easy
Replace # with the button numbers and motor with your victor


if (joystick.getRawButton(#) == true)
{
motor.set(0.25)
}
else
{
motor.set(0.0)
}
if (joystick.getRawButton(#) == true)
{
motor.set(-0.25)
}
else
{
motor.set(0.0)
}

Programmer Matt,
Gus Robotics, team228.org