/* =============================================================================================================================================
* 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);
}