DualShock 4 LED Bar Color Toggles

This GPC script lets you cycle through all the possible LED bar colors on the DualShock 4 controller. Read the comments in the script to see how to toggle the various colors. Press DOWN on the d-pad for a fun rainbow effect!
Version1.0
Authorperfecthuntr
Publish DateSun, 26 Apr 2015 - 18:44
Last UpdateSun, 26 Apr 2015 - 18:44
Downloads159
ForumAnnouncement Topic
RATE


5

0

Code: Select all
/* =============================================================================================================================================
* Controller:           DualShock 4
* GPC Author:           PerfectHuntr
**/

 
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* LED COLOR DEFINITIONS FOR PS4
* fSetLED(0,0,0,0); // Off
* fSetLED(1,0,0,0); // Blue
* fSetLED(0,1,0,0); // Red
* fSetLED(0,0,1,0); // Green
* fSetLED(0,0,0,1); // Pink
* fSetLED(1,0,1,0); // Cyan
* fSetLED(0,1,1,0); // Amber
* fSetLED(1,1,1,1); // White
**/

 
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* MAIN SCRIPT
**/

main {
    if (event_press(PS4_TOUCH))     { fSetLED(0,0,0,0); }   // TOUCH    = Off
    if (event_press(PS4_SQUARE))    { fSetLED(1,0,0,0); }   // SQUARE   = Blue
    if (event_press(PS4_TRIANGLE))  { fSetLED(0,1,0,0); }   // TRIANGLE = Red
    if (event_press(PS4_CIRCLE))    { fSetLED(0,0,1,0); }   // CIRCLE   = Green
    if (event_press(PS4_CROSS))     { fSetLED(0,0,0,1); }   // CROSS    = Pink
    if (event_press(PS4_LEFT))      { fSetLED(1,0,1,0); }   // LEFT     = Cyan
    if (event_press(PS4_UP))        { fSetLED(0,1,1,0); }   // UP       = Amber
    if (event_press(PS4_RIGHT))     { fSetLED(1,1,1,1); }   // RIGHT    = White
    if (event_press(PS4_DOWN))      { combo_run(Rainbow); } // DOWN     = Rainbow
}
 
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* COMBOS
**/

// Rainbow LED combo for PS4
combo Rainbow {
    fSetLED(0,1,0,0); // Red
    wait(500);
    fSetLED(0,1,1,0); // Amber
    wait(500);
    fSetLED(0,0,1,0); // Green
    wait(500);
    fSetLED(1,0,0,0); // Blue
    wait(500);
    fSetLED(1,0,1,0); // Cyan
    wait(500);
    fSetLED(0,0,0,1); // Pink
    wait(500);
    fSetLED(1,1,1,1); // White
    wait(500);
    fSetLED(0,0,0,0); // Off
    wait(500);
}
 
/* ---------------------------------------------------------------------------------------------------------------------------------------------
* FUNCTIONS
**/

// LED function for PS4
function fSetLED(a, b, c, d) {
    set_led(LED_1, a);
    set_led(LED_2, b);
    set_led(LED_3, c);
    set_led(LED_4, d);
}