VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex::controller::axis Class Reference

Use the axis class to get values from one of the controller's joysticks. More...

#include <vex_controller.h>

Public Member Functions

 axis (const tAxisType id, controller *parent)
 
void changed (void(*callback)(void)) const
 Sets the function to be called when the joystick axis value changes.
 
int32_t value (void) const
 Gets the value of the joystick axis on a scale from -127 to 127.
 
int32_t position (percentUnits units=percentUnits::pct) const
 Gets the position of the joystick axis on a scale from -100 to 100.
 

Detailed Description

Use the axis class to get values from one of the controller's joysticks.

Definition at line 143 of file vex_controller.h.

Constructor & Destructor Documentation

◆ axis() [1/2]

vex::controller::axis::axis ( )
inline

Definition at line 149 of file vex_controller.h.

◆ axis() [2/2]

vex::controller::axis::axis ( const tAxisType id,
controller * parent )
inline

Definition at line 150 of file vex_controller.h.

◆ ~axis()

vex::controller::axis::~axis ( )
inline

Definition at line 151 of file vex_controller.h.

Member Function Documentation

◆ changed()

void vex::controller::axis::changed ( void(* callback )(void)) const

Sets the function to be called when the joystick axis value changes.

Parameters
callbackA reference to a function.

◆ position()

int32_t vex::controller::axis::position ( percentUnits units = percentUnits::pct) const

Gets the position of the joystick axis on a scale from -100 to 100.

Returns
Returns an integer that represents the position of the joystick axis as defined by the unit in the parameter.
Parameters
units(Optional) The type of unit that will be returned. By default, this parameter is a percentage.

◆ value()

int32_t vex::controller::axis::value ( void ) const

Gets the value of the joystick axis on a scale from -127 to 127.

Returns
Returns an integer that represents the value of the joystick axis.

The documentation for this class was generated from the following file: