Help with Limit Switch Programming-RobotC

My team is trying to program a limit switch. When we add the sensor to the code the motors, the motors involved in the switch will run for a second, stop, and start back up again. Before we added the sensor, we never had an issue, and if I put the old code back, we don’t have the issue.

I added a picture of the part of the code the issue would be in.
issue code.JPG

Try adding delay(100); after giving power to the motors.

It worked. Thanks

@jpearman What is the bit of code that is vexRT[Ch2Xmtr2]? Is that a daisy chained motor?

That is Ch2 for a partner joystick

A partner joystick can be really helpful in some situations where you have two distinct mechanisms doing individual operations and you want both to be able to operate at the same time. RobotC suffixes the interface to access these buttons and sticks in RobotC with Xmtr2.

Guess this could be a little confusing, so to help you identify what its doing, you could always do something like this:

#define Ch2Partner Ch2Xmtr2

which would allow you to write: