problem with joystick buttons (top left one)

we are having a problem with the top left black button next to the FOV mini joystick on the joystick that FIRST has provided us.
our top right button works however…

i’m thinking maybe we dont have the correct variable. here is our code:::

/* 2nd joystick open globe motor arms */
	if (p2_sw_aux1==1) 
	{pwm01 = 200; }
	else if (p2_sw_aux2==1)  
	{pwm01 = 55; }
	else {pwm01=127;}

the else if statement is where i think the problem is but I’m not entirely sure.
help would be helpful.
love, richie

that looks correct - you can even simplify it as such:

    pwm01 = 200;
else if(p2_sw_aux2)
    pwm01 = 55;
    pwm01 = 127;

That should work. Try reading the OI data under Dashboard and see what the values the buttons on the joystick is putting out. It may be that the button is broken. Our top right on one of the joysticks is sticky and doesn’t work reliably.

In case anyone doesn’t know, there is a jumper next to the dashboard port on the OI that can be moved between RC and OI. Set it to OI and you see the values coming in on the ports of the OI.

thanks every one. the problem has been solved. the joysticks are really crappy and i think both of them are broken. it wasn’t the code as we thought.

open up the OI pdf file. there is a list of pinouts. the reason the button wont work is that not all the buttons are connected to a pin. if you put the joystick in port 2 the button that is not working is probably routed threw to port 3. you might want to look at the pin outs and see if this is your problem.

we just got new joysticks.i opened one one of the old ones up and some wires had come off and the little green board had a crack in it.