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 (line 849)

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

GPIO_CTRLBOX_ANALOG_INDEX

Index of the analog input port on the control box.

eAnalogType

GPIO_ANALOG_TYPE

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

Example

#include "DRFLEx.h"
using namespace DRAFramework;

int main() {
    CDRFLEx drfl;

    // 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.