Main Content

Competition Switch

Read switch positions of VEXnet Competition Switch and provide logical values for Autonomous and Driver modes

Add-On Required: This feature requires the Simulink Coder Support Package for ARM Cortex-based VEX Microcontroller add-on.

  • Competition Switch block

Libraries:
Simulink Coder Support Package for ARM Cortex-based VEX Microcontroller / Gamepad

Description

The Competition Switch block reads the switch positions of the VEXnet Competition Switch and provides the corresponding logical values (1 or 0) for the Autonomous mode and Driver mode. This block can be used to switch between the logic required for Driver mode and Autonomous mode, based on the switch position.

Ports

Input

expand all

Connect a source block to this port to simulate the position of the Competition Switch in the VEX competition.

Dependencies

This port appears only when you select the Add input ports for simulation parameter.

Data Types: Boolean

Connect a source block to this port to simulate the position of the Competition Switch in the VEX competition .

Dependencies

This port appears only when you select the Add input ports for simulation parameter.

Data Types: Boolean

Output

expand all

The output is 1 if the position of the switch is Autonomous on the VEXnet Competition Switch.

When the Auto output port is 1 and the Driver output port is 0, the robot is in Autonomous mode.

Data Types: Boolean

The output is 1 if the position of the switch is set at Driver in the VEXnet Competition Switch.

When the Auto output port is 0 and the Driver output port is 1, the robot is in Driver mode.

Data Types: Boolean

When both the Auto and Driver outputs are 0, the robot connected to the VEXnet Competition Switch is disabled.

Parameters

expand all

Select this check box to add two input ports – Auto and Driver – to simulate the position of the VEXnet Competition Switch.

How often the Competition Switch block should read the position of switch in VEXnet Competition Switch, specified in seconds. The default value is 0.02 seconds.

When the Sample time parameter is hidden and its value is inherited.

Dependencies

This parameter is only available when Add input ports for simulation is not selected.

Version History

Introduced in R2016a

See Also