For information on the latest version, please have a look at 1.33.5.
set_mode_analog_input
This function sets the input channel mode for an analog input port on the
robot controller’s control box.
Depending on the configuration, each analog input channel can operate
either in current mode (mA) or voltage mode (V).
Definition
DRFLEx.h within class CDRFLEx, public section
bool set_mode_analog_input(GPIO_CTRLBOX_ANALOG_INDEX eGpioIndex,
GPIO_ANALOG_TYPE eAnalogType = GPIO_ANALOG_TYPE_CURRENT)
{ return _set_mode_analog_input(_rbtCtrl, eGpioIndex, eAnalogType); };
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eGpioIndex |
Index of the analog input port on the control box. |
||
eAnalogType |
GPIO_ANALOG_TYPE_CURRENT |
Type of analog input mode. |
Return
Value |
Description |
|---|---|
0 |
Error — failed to configure the analog input mode |
1 |
Success — mode configuration applied successfully |
Note
A return of true does not confirm that the controller applied the request. Confirm the result with the corresponding getter or callback (for example get_digital_output, get_robot_system, get_robot_speed_mode).
Example
// Set analog input #1 to current mode (4–20 mA)
drfl.set_mode_analog_input(GPIO_CTRLBOX_ANALOG_INDEX_1, GPIO_ANALOG_TYPE_CURRENT);
// Set analog input #2 to voltage mode (0–10 V)
drfl.set_mode_analog_input(GPIO_CTRLBOX_ANALOG_INDEX_2, GPIO_ANALOG_TYPE_VOLTAGE);
This example configures analog input #1 to operate in current mode and analog input #2 in voltage mode, enabling the robot controller to read sensor values in both electrical signal formats.