CAN ANYONE HELP ME PLEASE??

I wrote a this code for our arm release:

if ( (ThirdStick->GetRawButton(6) ) )

   {    
   	ArmRelease -> Set(1.0);
   }
   	else
   	{
   		ArmRelease->Set(0.0);
   	}
           
   
   if ( (ThirdStick->GetRawButton(7) ) )                                      
            {
   	ArmRelease ->Set(-1.0);
            }
   else
   {
	   ArmRelease->Set(0.0);
   }

this means when i press buton 6 on the joystick the motor is supposed to go forward, and when i press button 7 on the joystick the motor is supposed o go backwards. button 6 work, the motor goes forward, but when i press button 7 it doesnt move. i even tried:

if ( (ThirdStick->GetRawButton(6) ) )

   {    
   	ArmRelease -> Set(1.0);

                       while (ThirdStick->GetRawButton(7)
                                {
                                    ArmRelease->Set(-1.0);
                                }
   }

else
{
ArmRelease->Set(0.0);
}

but it still dont work! :confused:

Huge flaw in your code. Here’s a hypothetical situation based on the first one shown:

Button is 6 is pressed. The motor is set to 1.0. However, almost immediately after that, button 7 is checked and most likely set to 0.0.

Here’s what I think you want:

if (ThirdStick->GetRawButton(6)) {
    ArmRelease->Set(1.0);
} else if (ThirdStick->GetRawButton(7)) {
    ArmRelease->Set(-1.0);
} else {
    ArmRelease->Set(0.0);
}

Also, I assume you mean if instead of while in that second code block. That version would only activate button 7 mode if button 6 was pressed

THANKS ALOT MAN!!!, I FORGOT ALL ABOUT ELSE IF STATEMENTS