There are two reasons reason for your problem:
The main loop is executed very fast - you only check conditionals and assign some values to variables. Total execution time will be probably in order of milliseconds. That means that when you press the button for even as short as 0.1s the loop will execute thousands of times. I would advice on checking the button states only every 50-200 milliseconds.
As already mentioned by SteveO, there is also an error in your logic. When variables
a
andc
reach their maximum values, there is no way to reset them to their original state. I would do that like:if(buttonIsPressed()) { changeVariable(); } if(variable > maxValue) { variable = maxValue; }
Also, are you sure that you want arm and claw go to their base positions when you release buttons? That would be the effect of
else(vexRT[Btn7D] == 0 && vexRT[Btn7U] == 0);
{
motor[Claw] = c;
}