Press Button to Reverse Direction EasyC

Hello,
I am currently in the BEST Robotics competition but I have a quick question regarding some code I need to execute for our robot. What I am trying to do is reverse the direction of the robot while holding down a key on the joystick.

For example. While the key is not pressed down, the joystick channels 2 up and 3 up will make the robot go forward (I am doing tank steering). When the key is pressed down, channels 2 down and 3 down will make the robot go forward instead of normally backward.

I have tried doing this in EasyC to no avail. Here is a screencap of my code. (http://puu.sh/cmDEY/08b8cd66ee.png)

Any suggestions on how to do this?

I don’t see anything obviously wrong with the code, but too late today to fire up the cortex and try it. What comes after the “else if” statement ?

Also, what currently happens when the code is run? Does it always run forward? Does it not run at all?

Currently, it runs in the forward orientation regardless if the button is pressed or not.

I tried this and it worked OK using EasyC 4.2.1.7. Perhaps there’s more code we cannot see below these blocks?

[ATTACH]8672[/ATTACH]
easyc_tank.jpg

Have you made sure to define the variable (int invert_control)

That’s all I could see thats possibly wrong because I have done similar stuff with my robot and it has always worked.

Team 1961 Fizzics