Why will my auton code not run?

I tried to program an auton to get the hang of programming, however my code will not run. It says I have downloaded the code and does not give any errors but none of the commands will run. My teammates code will run and that code is on a different laptop. Does anyone have any solutions?

What editor are you using to program your robot? Below is an example in VexCode. Pros may be a little different but follows the same conventions.

Does the program know that you want to use my_first_auton() as the autonomous program? This requires you to also bind to it in the main() function.

For example, using the V5 template in VexCode, I created a custom auton function.
Note the comments in the code.

// Include the V5 Library
#include "vex.h"

// Allows for easier use of the VEX Library
using namespace vex;

// Begin project code

void preAutonomous(void) {
  // actions to do when the program starts
  Brain.Screen.clearScreen();
  Brain.Screen.print("pre auton code");
  wait(1, seconds);
}

/// <<< ----Modified Code---- >>>
// I created my special Auton function here, and 
// I have to bind it below to a competition callback.

void MySpecialAutonomous(void) {
  Brain.Screen.clearScreen();
  Brain.Screen.print("autonomous code");
  // ...
}

void userControl(void) {
  Brain.Screen.clearScreen();
  // place driver control in this while loop
  while (true) {
    wait(20, msec);
  }
}

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();
  // create competition instance
  competition Competition;

// Set up callbacks for autonomous and driver control periods.

/// <<< ----Modified Code---- >>>
// Here I'm telling the Competition system that 
// MySpecialAutonomous function is the autonomous code to use.

  Competition.autonomous(MySpecialAutonomous);
  Competition.drivercontrol(userControl);

  // Run the pre-autonomous function.
  preAutonomous();

  // Prevent main from exiting with an infinite loop.
  while (true) {
    wait(100, msec);
  }
}
1 Like