Main Content

Gamepad Button

Represent one button on VEX gamepad and read logical value

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

  • Gamepad Button block

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


The Gamepad Button block is used to represent one of the 12 buttons on the VEX® gamepad. The block reads the corresponding logical value (1 or 0) based on whether the button is pressed or released.



expand all

Connect a source block, such as the Gamepad Simulator block from the Utilities library in Simulink® Support Package for ARM® Cortex®-based VEX Microcontroller.


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

Data Types: Boolean


expand all

When you press the button, the block output is 1; otherwise (in a released state of the button), the block output is 0.

During simulations without the hardware, this block emits zeroes if there is no source block connected to the input port (see Block Produces Zeros or Does Nothing in Simulation).

Data Types: Boolean


expand all

This parameter is read only. You can have a pair of VEX gamepads to control the peripherals connected to the VEX microcontroller. However, in the VEX Robotics and the BEST Robotics competitions, teams are allowed only one gamepad. Therefore, the Joystick is set to 1 by default, and it cannot be changed.

Select the channel or button group on the VEX gamepad. The VEX gamepad has four channels – 5, 6, 7, and 8 – which contain a total of 12 buttons.

The options for this parameter vary depending on the Channel that you select. Channels 5 and 6 have Up and Down buttons only, while channels 7 and 8 have Up, Down, Right, and Left buttons. Before you make the selection, review the labeling of the buttons on the VEX gamepad.

Select this check box to add an input port to specify a logical value of the button during simulation.

How often the Gamepad Button block should read the logical value of the button, specified in seconds. The default value is 0.02 seconds.


If you select the Add input port for simulation check box, the Sample time parameter is hidden and its value is inherited .

Extended Capabilities

Version History

Introduced in R2016a