LED Functions
Function Name | Description |
---|---|
set_led | Sets the state of the LED on a controller. |
get_led | Gets the state of the LED on a controller. |
set_ledx | Blinks a LED a certain number of times. |
get_ledx | Checks if a LED is being blinked by the set_ledx function. |
reset_leds | Reset the LEDs state to what was set by the console. |
get_ps4_lbar | Gets ps4 indication bar color. |
set_ps4_lbar | Sets Zen indication color. |
set_led sets the state of an LED on the controller. The LEDs range from 0 to 3. Four constants have been created to make it easier to remember which value is assigned to which LED:
Name | Description | Value |
---|---|---|
LED_1 | LED 1 / Xbox 360 Quadrant 1 | 0 |
LED_2 | LED 2 / Xbox 360 Quadrant 2 | 1 |
LED_3 | LED 3 / Xbox 360 Quadrant 3 | 2 |
LED_4 | LED 4 / Xbox 360 Quadrant 4 | 3 |
An LED can be set to one of four states using this function which ranges from 0 to 3, as shown in the table below:
Value | Description |
---|---|
0 | LED Off |
1 | LED On |
2 | LED Blink Fast |
3 | LED Blink Slowly |
🔴 Syntax
⚪ Parameters
<led_identifier> : the LED identifier. <led_state> : the state identifier of the controller LED.
🔵 Returns
None
get_led returns a value in the form of an int which represents the current state of the chosen LED. The return value from this function informs you of the current state of the selected LED. The function returns a value ranging from 0 ~ 3;
Return Value | Description |
---|---|
0 | LED Off |
1 | LED On |
2 | LED Blinking Fast |
3 | LED Blinking Slowly |
Example of usage:
🔴 Syntax
⚪ Parameters
<LED_Identifier> : The identifier of an LED
🔵 Returns
An int ranging from 0 ~ 3 which represents the current state
set_ledx is used to Blink and LED a set amount of times. You can blink a led from 0 to 255 times. 0 sets the LED to on. Example of usage:
🔴 Syntax
⚪ Parameters
<led_identifier> : the identifier of an LED<no_of_blinks> : The number of times to blink the LED
get_ledx checks to see if an LED is currently being blinked by the set_ledx function. Example of usage:
🔴 Syntax
⚪ Parameters
None
🔵 Returns
TRUE is the LEDs are being blinked by the set_ledx function, FALSE if they are not
reset_leds returns control of the LEDs to the console and disables any current LED states which are being set by the Virtual Machine. Example of usage:
🔴 Syntax
⚪ Parameters
None
The Dualshock 4 controller has one lightbar instead of four LEDs. The color of the lightbar can be controlled by setting all four led states simultaneously.
get_ps4_lbar gets the playstation 4 lightbar led state from the console.
get_ps4_lbar(Color) There is 3 Colors: PS4_RED, PS4_GREEN, and PS4_BLUE. They have a range from 0 - 255 ( Lower the number equals less brightness, higher the number equals more brighter ).
Example:
set_ps4_lbar sets the PlayStation 4 lightbar led state on the controller and sets the color that will be sent to the controller.
There are 3 Colors: DS4_RED, DS4_GREEN, and DS4_BLUE. They have a range from 0 - 255 ( Lower the number equals less brightness, higher the number equals more brighter ).
Example:
Example using both: