Motor only going in one direction

So the intake arm motor on our robot only turned in one direction, no matter how we changed the code. If the motor is in normal polarity, then it will only rotate anti-clockwise, no matter if we set it into forward or reverse direction. If the motor is in reversed polarity, then it will only rotate clockwise, regardless of forward or reverse direction. We plugged the motor into port 6, and the motor is a torque motor. We have tried to plug it into port 8, but it still isn’t fixed. We also tried uploading the code to another port on the controller, but it is still not working. We are having a tournament on this Saturday. If anyone can give out a helping hand, that will be great. Thank you!
By the way, here’s the code regarding the intake arm motor.

Intake arm code|644x357

  • Where is the stopintakearm function?
  • What is calling the intakearmcontrol function?
  • Do you reference the IntakeArm motor anywhere else in your code?

The stop intake arm function is meant to be triggered when buttons R1 and R2 are both not pressed. The intakearmcontrol function is called directly in the driver control function. No, I did not reference the IntakeArm motor else in the code, not even the the autonomous portion. The Intake Arm Motor is currently only used in the driver control period. Therefore, I don’t know what is wrong with it. If you could help, that would be very good. Thank you!

While I like the idea that you are taking advantage of functions, lets take a step back and use a basic routine to see if the hardware is working properly.

motor IntakeArm = motor(PORT6);

while(true) {
	if(Controller1.ButtonR1.pressing() {
	} else if(Controller1.ButtonR2.pressing()) {
	} else {

Thank you for your help! I just copied everything from the new code into an old code and it suddenly worked. I think that was a bug in the code, but thanks for replying!

The issue you had was incorrect use of “pressed”. This function is used to register an event handler and should only be called once, usually at the beginning of the main function.