.. _get_state_led_rule: get_state_led_rule ------------------------------------------ This function retrieves the **current LED rule** that is applied to the robot arm’s state LED. Available in Auto mode only, on controller v3.4 or later. In other modes, or on an older controller, the function returns 0. The mode check uses the value returned by :ref:`get_robot_mode `. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp unsigned char get_state_led_rule() { return _get_state_led_rule(_rbtCtrl); }; **Parameter** |br| None **Return** .. list-table:: :widths: 20 60 :header-rows: 1 * - **Value** - **Description** * - 0 - Default. Also returned when the call is refused. * - 1 - Custom by state * - 2 - Custom by command **Example** .. code-block:: cpp // 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; } // Get the current LED rule (0-2) unsigned char ledRule = Drfl.get_state_led_rule(); // Display the meaning of the LED rule switch (ledRule) { case 0: printf("LED rule: default.\n"); break; case 1: printf("LED rule: custom by state.\n"); break; case 2: printf("LED rule: custom by command.\n"); break; default: printf("LED rule: unknown (%d).\n", (int)ledRule); break; } This example retrieves the **current LED rule value** using `get_state_led_rule()` and prints which rule the controller applies to the state LED.