Controller: Arcarde Style in RobotC

We are using the following code the following code we made to control the robots movements with the left joystick, but we can only move forward <-> backward or left <-> right. We would like to include some forward <-> right movement.

Anyone has any suggestions?

[FONT=Consolas]int[/FONT] threshold = 10; [FONT=Consolas]//* esto le da un rango de movimiento al control. NO cambie este numero *//[/FONT]
[FONT=Consolas]while/FONT
{
[FONT=Consolas]// – Para Joystick que tiene Canal A MANO Izquierda -------------------------------------[/FONT]
[FONT=Consolas]if[/FONT](getJoystickValue(ChC) > threshold || getJoystickValue(ChC) < -threshold)
{
[FONT=Consolas]if[/FONT](getJoystickValue(ChC) > threshold)
{
setMotorSpeed(izquierdo, getJoystickValue(ChC));
setMotorSpeed(derecho, -getJoystickValue(ChC));
}
[FONT=Consolas]else[/FONT]
{
setMotorSpeed(izquierdo, getJoystickValue(ChC));
setMotorSpeed(derecho, -getJoystickValue(ChC));
}
}
[FONT=Consolas]else[/FONT]
{
[FONT=Consolas]if[/FONT](getJoystickValue(ChA) > threshold || getJoystickValue(ChA) < -threshold)
{
setMotorSpeed(izquierdo, getJoystickValue(ChA));
setMotorSpeed(derecho, getJoystickValue(ChA));
}
[FONT=Consolas]else[/FONT]
{
setMotorSpeed(izquierdo, 0);
setMotorSpeed(derecho, 0);
}
}

}

Look in the RobotC sample programs under Wireless controller.

Here are the key lines

    //Set the speed of the two motors the value from the two joystick values in the formula.
    setMotorSpeed(leftMotor,  (getJoystickValue(ChA) + getJoystickValue(ChB))/2);      // (y - x)/2
    setMotorSpeed(rightMotor, (getJoystickValue(ChA) - getJoystickValue(ChB))/2);      // (y + x)/2

Steve

Steve, you are just awesome. We gotta met your team at Anaheim.