get_digital_input

This function reads the current signal state of a digital input port on the robot controller’s control box. It is used to check whether the specified input port is currently receiving a high (ON) or low (OFF) signal.

This function is typically used for monitoring external sensors, switches, or safety interlocks connected to the robot’s digital input terminals.

Version Note
- If DRCF version = 2, this function internally calls _get_digital_input().
- If DRCF version = 3, it calls _get_digital_input_ex() for extended I/O compatibility.
Refer to get_library_version for checking the current DRCF version.

Definition
DRFLEx.h within class CDRFLEx, public section (line 837/842)

#if DRCF_VERSION == 2
bool get_digital_input(GPIO_CTRLBOX_DIGITAL_INDEX eGpioIndex) {
    return _get_digital_input(_rbtCtrl, eGpioIndex);
};
#elif DRCF_VERSION == 3
bool get_digital_input(GPIO_CTRLBOX_DIGITAL_INDEX eGpioIndex) {
    return _get_digital_input_ex(_rbtCtrl, eGpioIndex);
};
#endif

Parameter

Parameter Name

Data Type

Default Value

Description

eGpioIndex

GPIO_CTRLBOX_DIGITAL_INDEX

Index of the digital input port on the control box.

Return

Value

Description

0

OFF — no signal detected (input is low)

1

ON — signal detected (input is high)

Example

#include "DRFLEx.h"
using namespace DRAFramework;

int main() {
    CDRFLEx drfl;

    // Read the current signal of digital input #1
    bool bSignal = drfl.get_digital_input(GPIO_CTRLBOX_DIGITAL_INDEX_1);

    if (bSignal)
        printf("Digital input #1 is currently ON\n");
    else
        printf("Digital input #1 is currently OFF\n");
}

This example checks whether digital input #1 is currently active and prints the corresponding state to the console. It can be used to monitor signals from limit switches, sensors, or emergency stop circuits.