set_state_led_off

This function turns OFF the state LED on the robot arm. It disables the LED light completely, regardless of its previously set color or rule configuration.

Available in Auto mode only, on controller v3.4 or later. In other modes, or on an older controller, the function returns false. The mode check uses the value returned by get_robot_mode.

Definition
DRFLEx.h within class CDRFLEx, public section

bool set_state_led_off()
{
    return _set_state_led_off(_rbtCtrl);
};

Parameter
None

Return

Value

Description

0

Fail — failed to turn off the LED

1

Success — LED successfully turned off

Note

A return of true does not confirm that the LED changed.

Example

// Assumes control authority is held; the LED functions work only in Auto mode
if (!Drfl.set_robot_mode(ROBOT_MODE_AUTONOMOUS)) {
    printf("set_robot_mode failed.\n");
    return 1;
}

// Set LED to red to indicate an active warning state
if (Drfl.set_state_led_color(1, 0, 0))  // Red color
    printf("LED set to red: warning active.\n");

// Simulate a few seconds of system alert
std::this_thread::sleep_for(std::chrono::seconds(2));

// Turn off all LED lights (e.g., entering standby or power-save mode)
if (Drfl.set_state_led_off())
    printf("LED lights turned off for standby mode.\n");

// Wait and then reset LED to system default when resuming operation
std::this_thread::sleep_for(std::chrono::seconds(2));
if (Drfl.state_led_reset())
    printf("LED restored to default system color.\n");

This example demonstrates how to turn off the robot arm’s LED lights when entering a standby or power-save mode. After displaying a red warning state, all LEDs are turned off using set_state_led_off(), and later restored to the default system configuration.