Main Content

Gamepad Joystick

Represent one of the control axis on an x-y analog joystick on VEX V5 Controller gamepad and read the values

Add-On Required: This feature requires the Simulink Coder Support Package for VEX EDR V5 Robot Brain add-on.

  • Gamepad Joystick block

Libraries:
Simulink Coder Support Package for VEX EDR V5 Robot Brain / Gamepad

Description

The Gamepad Joystick block is used to represent one of the control axis of an x-y analog joystick on the VEX® V5 Controller gamepad, and read the corresponding analog value based on the position of the joystick along that axis. There are two analog joysticks on the VEX V5 Controller gamepad with two control axes on each joystick.

Ports

Output

expand all

The block output ranges from -128 to 127 based on the position of the joystick along the specified control axis. A value of 0 indicates that the joystick has not been moved along the axis.

During simulations, without the hardware, this block emits zeroes if there is no Source block connected the simulation input port (see Block Produces Zeros or Does Nothing in Simulation). During code generation, any simulation block that is connected to the input port of Gamepad Joystick block is ignored and has no effect on the generated code.

Data Types: double

Parameters

expand all

You can have a pair of VEX V5 Controller gamepads to control the peripherals connected to VEX EDR V5 Robot Brain.

Select the control axis based on the labelling of the joysticks on the VEX gamepad. The right joystick has horizontal axis labelled as 1 and vertical axis labelled as 2. The left joystick has horizontal axis labelled as 3 and vertical axis labelled as 4. Based on your selection of this parameter, the mask icon of the block is updated in the Simulink Editor.

Specify how often the Gamepad Joystick block should read the values from the gamepad's joystick. The default value is 0.02 seconds.

Version History

Introduced in R2018b