led_set — Set LED intensity and duty length
void led_set(<LED_IDENTIFIER>, fix32 intensity, uint32 dutylength);
Set the intensity and duty length values of the LED identified by <LED_IDENTIFIER>.
ATTENTION: The led_set() holds the last state set and should NOT be called on every interaction of main . |
Depending on the “Device Lightbar” option in device settings, the led_set() also have effect on the Titan Two lightbar. |
DualShock 4 and Titan Two Lightbar RGB Map | |
---|---|
LED_1 | Blue |
LED_2 | Red |
LED_3 | Green |
Always set LED_4 to 0.0 when configuring colors using the RGB spectrum. |
LED_1
, LED_2
, LED_3
or LED_4
. Note: the LED identifier is passed as direct parameter of the led_set()
opcode, therefore stack values can't be used.The intensity value is only fully supported by DualShock 4 controllers and for the others controllers this parameter is interpreted as binary value to turn the LED on or off. |
The dutylength value is only fully supported by DualShock 3 controllers, for the others controllers this parameter is ignored. |
No value is returned.
init { uint8 protocol; port_status(PORT_USB_A, &protocol, NULL); // If there is an PS3 controller on INPUT-A ... if(protocol == PROTOCOL_PS3) { // ... blink the player LED_2. led_set(LED_1, 0.0, 0); led_set(LED_2, 100.0, 400); led_set(LED_3, 0.0, 0); led_set(LED_4, 0.0, 0); } }
void set_rgb(fix32 r, fix32 g, fix32 b) { led_set(LED_1, b, 0); led_set(LED_2, r, 0); led_set(LED_3, g, 0); led_set(LED_4, 0.0, 0); printf("rgb(%0.2f, %0.2f, %0.2f)", r, g, b); return; }