We have found that having limits in the arms and other moveable parts can help to make the robot easier to control. Originally, we used rotation counters and a variable that changed depending on where the arm was, but this took a lot of work to program.
We came up with a new method. Much easier to program. You will need to find your motor rotation limits so you can put those values in instead of ours.
NOTE: this method requires that you start with the arm/etc in the same position each time. we just start with it DOWN every time we run the code.
The the arm motors have a ‘when armup’, ‘when armdown’, and ‘when armstop’ that simply spins forward/reverse or stops.