Triggering Autonomous Mode

Hello,

Is there a way to trigger the robot to begin Autonomous mode by pushing a button on the joystick? I would like to download a program to the robot using the USB. I would then like to unplug the USB from the robot, plug the Vex Key back in, set the robot onto the field, and then push a button on the joystick to trigger the 15 second autonomous portion of the match. Please let me know if this is possible.

Thanks!

There is no “out of the box” way to do this without writing some additional code, here is an example that checks for joystick buttons in the pre-auton function that may do what you want.

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks
  // running between Autonomous and Driver controlled modes. You will need to
  // manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;

  // Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
  // used by the competition include file, for example, you might want
  // to display your team name on the LCD in this function.
  // bDisplayCompetitionStatusOnLcd = false;

  // test if we are not connected to the competition switch
  if( !(nVexRCReceiveState & vrCompetitionSwitch) ) {
    // so no competition switch
    while( !(nVexRCReceiveState & vrCompetitionSwitch) ) {
      // 7U starts autonomous
      if( vexRT Btn7U ] ) {
        while( vexRT Btn7U ] )
          wait1Msec(10);
        // Start the autonomous task
        startTask(autonomous);
        writeDebugStreamLine("start auton");
        // wait 15 seconds
        wait1Msec(15 * 1000);
        allMotorsOff();
        allTasksStop();
        // short wait before we do that again
        wait1Msec(5000);
      }
      else
      if( vexRT Btn7D ] ) {
        while( vexRT Btn7D ] )
          wait1Msec(10);
        // Start the usercontrol task
        startTask(usercontrol);
        writeDebugStreamLine("start user control");
        // wait 105 seconds
        wait1Msec(105 * 1000);
        allMotorsOff();
        allTasksStop();
        // short wait before we do that again
        wait1Msec(5000);
      }

    wait1Msec(20);  
    }
  }
}