CrcLib: How to access the remote controller buttons
This page presents how CrcLib functions can use a remote controller buttons and joystick states. It details the different types declared in CrcLib.
Analog
ANALOG
An enum class representing the available analog channels on the remote controller connected via a CrcConnect module. These are different from the 4 Analog inputs (pins) of your board.
The members of the enum, listed below, are to be used in tandem with the ReadAnalogChannel()
, MoveTank()
, MoveArcade()
or MoveHolomonic()
function.
Members:
JOYSTICK1_X
: The horizontal axis of the left stick.JOYSTICK1_Y
: The vertical axis of the left stick.JOYSTICK2_X
: The horizontal axis of the right stick.JOYSTICK2_Y
: The vertical axis of the right stick.GACHETTE_L
: The pressure button at the back of the remote controller, left side.GACHETTE_R
: The pressure button at the back of the remote controller, right side.NONE
: No value. This should not be used and exists mainly for implementation details.
Click here for more details on the joystick mapping, depending on the remote controller used.
In C/C++, a call to a member of an enum class must be preceded by the name of the enum, followed by ::
. For example, the following syntax must be used in a function call:
CrcLib::ReadAnalogChannel(ANALOG::JOYSTICK1_X)
;
Button
BUTTON
An enum class representing the available digital channels on the remote controller connected via a CrcConnect module. These are different from the 12 Digital inputs (pins) of your board.
The members of the enum, listed below, are to be used in tandem with the ReadDigitalChannel()
function.
Members:
ARROW_RIGHT
ARROW_UP
ARROW_LEFT
ARROW_DOWN
COLORS_RIGHT
COLORS_UP
COLORS_LEFT
COLORS_DOWN
SELECT
START
L1
R1
HATL
HATR
LOGO
NONE
: No value. This should not be used and exists mainly for implementation details.
Click here for more details on the button mapping, depending on the remote controller used.
In C/C++, a call to a member of an enum class must be preceded by the name of the enum, followed by ::
. For example, the following syntax must be used in a function call:
CrcLib::ReadDigitalChannel(BUTTON::L1)