VEXcode Doxygen
Public Member Functions | Public Attributes | List of all members
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))
 Sets the function to be called when the joystick axis value changes. More...
 
int32_t value (void)
 Gets the value of the joystick axis on a scale from -127 to 127. More...
 
int32_t position (percentUnits units=percentUnits::pct)
 Gets the position of the joystick axis on a scale from -100 to 100. More...
 

Public Attributes

mevent CHANGED = { (uint32_t)_parent->_getIndex(), (uint32_t)_joystickToChangedEvent() }
 

Detailed Description

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

@prog_lang{block|cpp|pro}

Member Function Documentation

◆ changed()

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

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

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{changed(changedFunction);}

Parameters
callbackA reference to a function.

◆ position()

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

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

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{position(percent)} @cpp_sig{position(vex::percentUnits::pct)}

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  )

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

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{value()}

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

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