# Register (aka "bind") input/output control with data/control
To work properly, all controls need to be associate ("register") with data or command :
- An output control (LED for example) need to be register with an X-Plane input data.
- An input control (Push button for example) need to be register with an X-Plane command.
Each input control registered with command(s) will send the associated command when its state change.
Each registered output control with data will change when associated data change.
# Register input control with X-Plane command
To register input control and X-Plane command together you need to use the RegisterInputControl
method on the application instance :
cockpitApp->RegisterInputControl(
new ArduinoPushButtonControl(40),
new XPlaneSimpleCommand("sim/annunciator/test_all_annunciators")
);
void RegisterInputControl( ArduinoInputControl *ctrl, XPlaneOutputCommand *cmd1 = NULL, ...);
Arguments definition :
ArduinoInputControl *ctrl
: Pointer to the input control to register.XPlaneOutputCommand *cmd1
(default: NULL) : Pointer to output command....
: Other output command (for multiple positions control). Max number of argumen depending on the library configuration
# Register output control with X-Plane data
To register output control and X-Plane data together you need to use the RegisterOutputControl
method on the application instance :
cockpitApp->RegisterOutputControl(
new ArduinoLEDControl(32),
new XPlaneInputData(67, 0)
);
void RegisterOutputControl( ArduinoOutputControl *ctrl, XPlaneInputData *data, inputDataTransformFunction fct = NULL);
Arguments definition :
ArduinoOutputControl *ctrl
: Pointer to the output control to register.XPlaneInputData *data
: Pointer to input data.inputDataTransformFunction fct
(default: NULL) : Transformation function (Use whole group's data to determine control state). See Transformation function for more information.