The way you have it written, the arm should essentially never go up and maybe never move. I say “essentially” because maybe just slightly. The problem is with your if-then. If you try to lift it, you set the motors to lift, otherwise turning it off. You do the same with lowering. Consider this sequence:
I’m holding only 7u:
- Is 7u true? Yes. So set the motors to ±127.
- Let essentially no time pass.
- Is 7d true? No. Turn off all the motors.
You haven’t let go of the button, but the motors have shut off nearly immediately. Nearly the same thing is likely to happen with 7d, but I can’t see the rest of the code to gauge how big the delay is between checking 7d and cycling back around to check 7u.
What you really want to (in pseudo-code) do is this:
if 7u is true, set motors to lift
else if 7d is true, set motors to lower
else turn motors off
The else if part in the middle is essential unless you want to imbed the if-then statements within each other to accomplish the same thing. This way you only hit the turning motors off if both of the prior conditions fail.