VEXcode Doxygen
Public Member Functions | Public Attributes | List of all members
vex::controller::button Class Reference

Use the button class to get values from the controller's buttons. More...

#include <vex_controller.h>

Public Member Functions

 button (const tButtonType id, controller *parent)
 
void pressed (void(*callback)(void))
 Sets the function to be called when the button is pressed. More...
 
void released (void(*callback)(void))
 Sets the function to be called when the button is released. More...
 
bool pressing (void)
 Gets the status of a button. More...
 

Public Attributes

mevent PRESSED = { (uint32_t)_parent->_getIndex(), (uint32_t)_buttonToPressedEvent() }
 
mevent RELEASED = { (uint32_t)_parent->_getIndex(), (uint32_t)_buttonToReleasedEvent() }
 

Detailed Description

Use the button class to get values from the controller's buttons.

@prog_lang{block|cpp|pro}

Member Function Documentation

◆ pressed()

void vex::controller::button::pressed ( void(*)(void)  callback)

Sets the function to be called when the button is pressed.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{pressed(pressedFunction);}

Parameters
callbackA reference to a function.

◆ pressing()

bool vex::controller::button::pressing ( void  )

Gets the status of a button.

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

Returns
Returns a Boolean value based on the pressed states of the button. If the button is pressed it will return true.

◆ released()

void vex::controller::button::released ( void(*)(void)  callback)

Sets the function to be called when the button is released.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{released(releasedFunction);}

Parameters
callbackA reference to a function.

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