GPC Developer Guides
...
Functions
Controller Functions

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 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 gpc set led(led 1, 0); // turn the led off set led(led 1, 1); // turn the led on set led(led 1, 2); // make the led blink fast set led(led 1, 3); // make the led blink slowly 🔴 syntax set led( \<led identifier>,\<led state>); ⚪ parameters \<led identifier> the led identifier \<led state> the state identifier of the controller led 🔵 returns none get led 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 gpc main { if(get led(led 2) == 1) { // if led 2 is on // do something } } 🔴 syntax get led ( \<led identifier> ); ⚪ parameters \<led identifier> the identifier of an led 🔵 returns an int ranging from 0 3 which represents the current state set ledx 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 gpc main { if(!get ledx()) { // if the leds are not blinking set led(led 1, 3); // blink led 1 3 times } } 🔴 syntax set ledx ( \<led identifier> , \<no of blinks> ); ⚪ parameters \<led identifier> the identifier of an led\<no of blinks> the number of times to blink the led get ledx get ledx checks to see if an led is currently being blinked by the set ledx function example of usage gpc main { if(get ledx()) { // if the leds are blinking // do something } } 🔴 syntax get ledx ( ); ⚪ parameters none 🔵 returns true is the leds are being blinked by the set ledx function, false if they are not reset leds 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 gpc main { if(event press(xb1 a)) { // if a / cross is pressed reset leds(); // reset leds } } 🔴 syntax reset leds ( ); ⚪ parameters none setting ds4 lightbar 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 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 gpc if(get ps4 lbar(ps4 green)){ // will check if the console is sending green lightbar to controller set ps4 lbar 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 gpc set ps4 lbar(0, 0, 255); // will set the ds4 lightbar to bright green set ps4 lbar(0, 255, 0); // will set the ds4 lightbar to bright red set ps4 lbar(255, 0, 0); // will set the ds4 lightbar to bright blue example using both gpc main{ &#x9;if(get ps4 lbar(true, 255, ps4 green)){ //checks if console sending green to controller &#x9; set ps4 lbar(0, 225, 0) ; // sets contoller lightbar to red if console sending green to controller &#x9; }