Unofficial Response to "IT'S NOT WORKING!!!"


//Partially fixed code. Work on making sure button and stick statements do not conflict with each other.

task main()
      if (abs(vexRT[Ch3])> 10) {
         motor [bleftMotor] = vexRT[Ch3];
      else {
         motor[bleftMotor] = 0;

      if (abs(vexRT[Ch2])> 10) {
         motor[brightMotor] = vexRT[Ch2]; 
      else {
         motor[brightMotor] = 0;

//arm and fork motors

motor [bleftarmMotor] = vexRT[Btn5D] * 127;
motor [brightarmMotor] = vexRT[Btn5U] * 127;
motor [forkleftMotor] = vexRT[Btn6D] * 127;
motor [forkrightMotor] = vexRT[Btn6U] * 127;


These are the issues I found with your code:

  • No brackets with while and if statements in code. Brackets are very important in statements.
    *Conflicting statements: Even if the stick-based movement code works, after that statement ends, the Cortex encounters the button statements, and the buttons are either 1 or 0, meaning the motors are immediately told to shut off right after they receive the stick inputs. You need to make sure those do not conflict with each other. Also, you want to multiply the button inputs by 127, so that the motors actually move.
    *Only one direction in button control? Your buttons seem to control in only one direction.


Whoops, I didn’t notice the lack of braces. Screamin’EaglesGV, either the solution above or the solution written in my unofficial response will cause the arm and fork to work. But please read both responses carefully so that you understand what was wrong with your previous code.

This actually doesn’t matter in this case. You don’t need braces when only 1 line of code is to be run upon the condition returning true.

Which is why the code (assumedly) worked for the analog-stick-controlled motors. However, it’s still a good practice to include the braces just in case you need to add more to the statement, and to keep that organizational habit.

We got the program fixed. Thanks for all your suggestions