# If help

We are trying to fix an issue with a hold on the arms of the robot. I do not have the code with me right now, but I will throw some pseudo code to see if I get some ideas or help

The arm stays down before auton, but once deployed it stays about 3 inches to high to get stars. So the team wants to make a hold where once they get it down they use minimal power to keep it to the ground without tripping the PTCs. They were trying all kinds of ifs, else ifs, and else stuff on controller 2 with no luck. Controller 1 controls the base and lift while controller 2 controls the claw.
My thought was some thing like this:
Button 5U lifts the arm and 5D lowers it. My thought is or was to maybe see if there was a way to make the hold deploy if both 5D and 5U were pushed at the same time. IS this possible?
What would the code be like?
I thought: (simplified pseudo)
If 5U is pushed then motors up 127
else If 5D is pushed then motors down -127
Else If 5U and 5D are pushed then motors down -25
Else motor == 0

Does this sound right or doable?
They have a very short amount of time to get it right in the lab Monday.
Thanks for and help or examples.

Do you have a potentiometer on your lift? (arm) The easiest way to do this would be to have a simple if statement that runs when the buttons are not pressed, such as this code we are using for our claw:

``````		if((vexRT[Btn6U] != 1)&&(vexRT[Btn6D] != 1)&&(vexRT[Btn8U] != 1)&&(vexRT[Btn8D] != 1))
{
if(SensorValue[Clawpot] < 156)
{
ClawMotor = 20;
}
else
{
ClawMotor = 0;
}
}
``````

Essentially if the claw (or lift) is below a specified position it applies a low motor power to hold the mechanism in place when other commands aren’t been given to the motors.

They don’t have one but could easily add one. I will have them look at this code and idea.
Thanks