VEX V5 C++ API
Public Member Functions | List of all members
vex::competition Class Reference

Use this class to set up your program for competitions. More...

Public Member Functions

 competition ()
 Creates a competition object that has access to competition methods. More...
 
 ~competition ()
 
void autonomous (void(*callback)(void))
 Calls a function on a new thread when the autonomous period starts. That thread is interrupted when the autonomous period ends. More...
 
void drivercontrol (void(*callback)(void))
 Calls back a function on a new thread when the driver control period starts. That thread is interrupted when the driver control period ends. More...
 
bool isEnabled ()
 Gets the status of your robot when under competition control. More...
 
bool isDriverControl ()
 Gets the status of the Driver Control period. More...
 
bool isAutonomous ()
 Gets the status of the Autonomous period. More...
 
bool isCompetitionSwitch ()
 Gets the status of the Competition Control Switch being plugged into the robot. More...
 
bool isFieldControl ()
 Gets the status of the Field Control System being plugged into the robot. More...
 

Detailed Description

Use this class to set up your program for competitions.

Constructor & Destructor Documentation

◆ competition()

vex::competition::competition ( )

Creates a competition object that has access to competition methods.

◆ ~competition()

vex::competition::~competition ( )

Member Function Documentation

◆ autonomous()

void vex::competition::autonomous ( void(*)(void)  callback)

Calls a function on a new thread when the autonomous period starts. That thread is interrupted when the autonomous period ends.

Parameters
callbackA reference to a function. Only one reference is stored, subsequent calls override any previous callbacks.

◆ drivercontrol()

void vex::competition::drivercontrol ( void(*)(void)  callback)

Calls back a function on a new thread when the driver control period starts. That thread is interrupted when the driver control period ends.

Parameters
callbackA reference to a function. Only one reference is stored, subsequent calls override any previous callbacks.

◆ isEnabled()

bool vex::competition::isEnabled ( )

Gets the status of your robot when under competition control.

Returns
Returns a Boolean based on if the autonomous or driver control periods is active. If either one is active, the Boolean will return true.

◆ isDriverControl()

bool vex::competition::isDriverControl ( )

Gets the status of the Driver Control period.

Returns
Returns a Boolean based on if the Driver Control Period is active. If the Driver Control period is active, the Boolean will return true.

◆ isAutonomous()

bool vex::competition::isAutonomous ( )

Gets the status of the Autonomous period.

Returns
Returns a Boolean based on if the Autonomous Period is active. If the Autonomous Period is active, the Boolean will return true.

◆ isCompetitionSwitch()

bool vex::competition::isCompetitionSwitch ( )

Gets the status of the Competition Control Switch being plugged into the robot.

Returns
Returns a Boolean based on if the V5 is connected to the Competition Control Switch. If the Brain is connected, the Boolean will return true.

◆ isFieldControl()

bool vex::competition::isFieldControl ( )

Gets the status of the Field Control System being plugged into the robot.

Returns
Returns a Boolean based on if the V5 is connected to the Filed Control System. If the Brain is connected, the Boolean will return true.