There is an error; "function definition is not allowed here (64,3)"

148 Views Asked by At

The bracket is located after int main (). This is for VEX robotics. I'm using VexCode V5 to program the Robot. This is C++. This code is to allow the robot to drive forward and backward, and also side ways using the specific kind of wheels needed. If I'm not mistaken that names of those wheels are mecanum wheels.

{
 Motor1.spin(forward);
 Motor2.spin(forward);
 Motor3.spin(forward);
 Motor4.spin(forward);

 int main ()
 {
  while(true)
   {
     // REMEMBER:
     // m1(x, y) = y + x
     // m2(x, y) = y - x
     // m3(x, y) = y + x
     // m4(x, y) = y - x

     // motor[Front_Left] = 1
     // motor[Front_Right] = 2
     // motor[Back_Right] = 3
     // motor[Back_Left] = 4

     // vexRT[Ch1] = Left/Right
     // vexRT[Ch2] = Up/Down
     // vexRT[Btn5U] = Counter-Clockwise
     // vexRT[Btn6U] Clockwise

     motor[Front_Left] = vexRT[Ch2] + vexRT[Ch1];
     motor[Front_Right] = vexRT[Ch2] - vexRT[Ch1];
     motor[Back_Right] = vexRT[Ch2] + vexRT[Ch1];
     motor[Back_Left] = vexRT[Ch2] - vexRT[Ch1];

     if (vexRT[Btn5U] == 1) {
       // rotate counter clockwise
       motor[Front_Left] = -127;
       motor[Front_Right] = 127;
       motor[Back_Right] = 127;
       motor[Back_Left] = -127;
       wait1Msec(50);
       motor[Front_Left] = motor[Front_Right] = motor[Back_Right] = motor[Back_Left] = 0;
     }
     if (vexRT[Btn6U] == 1) {
       //rotate clockwise
       motor[Front_Left] = 127;
       motor[Front_Right] = -127;
       motor[Back_Right] = -127;
       motor[Back_Left] = 127;
       wait1Msec(50);
       motor[Front_Left] = motor[Front_Right] = motor[Back_Right] = motor[Back_Left] = 0;
     }
   } //END OF WHILE LOOP
 } //END OF TASK MAIN
}
0

There are 0 best solutions below