@Screamin’EaglesGV
//Partially fixed code. Work on making sure button and stick statements do not conflict with each other.
task main()
{
while(1==1)
{
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.