You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.
For information on the latest version, please have a look at 1.33.5.
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 get_robot_mode.
Definition
DRFLEx.h within class CDRFLEx, public section
unsigned char get_state_led_rule()
{
return _get_state_led_rule(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
0 |
Default. Also returned when the call is refused. |
1 |
Custom by state |
2 |
Custom by command |
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;
}
// 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.