Skip to main content

Writing Autons

  1. Go to \include\autons.h and add your auton using the format void my_first_auton();. This is called the function declaration.
  2. Go to \src\autons.cpp and add your auton using the following format:
void my_first_auton(){

}

Your code will go within the brackets. For example:

void my_first_auton(){
chassis.drive_distance(12);
chassis.turn_to_angle(90);
chassis.drive_distance(12);
chassis.drive_distance(-12);
chassis.turn_to_angle(0);
chassis.drive_distance(-12);
}

This code should drive in an L shape and return to its start along the same path, and this segment of code is the function's definition.

  1. Go to \src\main.cpp and scroll to the void pre_auton() function. Pick a case (in this example we'll pick 0) and change the name of the auton displayed on the brain screen in auton selection. The code will look like
case 0:
Brain.Screen.printAt(5, 140, "My First Auton");
break;
  1. In \src\main.cpp, scroll to the void autonomous() function. Using the same case you picked in step 3, change the auton function called within that case. The code will look like
case 0:
my_first_auton();
break;
  1. Test your auton. If you chose case 0, this is the default auton and you don't have to select the correct auton from the brain screen. For other cases, you'll need to tap on the brain screen in pre auton until you reach the desired auton.