Arduino Gamepad programming question

Hi All

So I have made a buttonbox gamepad for my PC, all is working great using Joystic, keypad and DynamicHID libraries. Code works and is picked up as it should and doing what it should. So here is my question, I have a button matrix with 5 columns and 6 Rows connected to digital pins and giving a total of 30 buttons i can make it more but my box only has 30 so its fine, now my question here is i want certain button presses to light up an LED how would i do that and what pins should LED be connected to, to be able to do this for instance if button 4 of gamepad state is set to 1 the LED must light up. Below is my sketch. As you can see i also set cases for when button is HOLD it should set state to 0 because i have toggle switches that when switched on stays on and i dont want that, but i was thinking if there is a way to set a case for only a certain button/s thats my second question. Any help would be greatly appreciated. Code Below.

#include <Joystick.h>
#include <Keypad.h>
#include <DynamicHID.h>

#define ENABLE_PULLUPS

#define NUMBUTTONS 30
#define NUMROWS 6
#define NUMCOLS 5

int Dial1 = A0;
int Dial2 = A1;
int Dial3 = A2;

byte buttons[NUMROWS][NUMCOLS] = {
{0, 1, 2, 3, 4},
{5, 6, 7, 8, 9},
{10, 11, 12, 13, 14},
{15, 16, 17, 18, 19},
{20, 21, 22, 23, 24},
{25, 26, 27, 28, 29}
};

byte rowPins[NUMROWS] = {7, 8, 9, 10, 11, 12};
byte colPins[NUMCOLS] = {2, 3, 4, 5, 6};

Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS);

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_GAMEPAD, 30, 0, false, false, true, false, false, false, true, true, false, false, false);

void setup() {
Joystick.begin();
Joystick.setZAxisRange(0, 1023);
Joystick.setRudderRange(0, 1023);
Joystick.setThrottleRange(0, 1023);
}

void JButtonStates() {
Joystick.setZAxis(analogRead(Dial1));
Joystick.setRudder(analogRead(Dial2));
Joystick.setThrottle(analogRead(Dial3));
}

void loop() {
JButtonStates();
delay(10);
CheckAllButtons();

}

void CheckAllButtons(void)
{
if (buttbx.getKeys())
{
for (int i = 0; i < LIST_MAX; i++)
{
if ( buttbx.key*.stateChanged )*
{
switch (buttbx.key*.kstate)*
{
case PRESSED:
Joystick.setButton(buttbx.key*.kchar, 1);*
break;
case HOLD:
case RELEASED:
case IDLE:
Joystick.setButton(buttbx.key*.kchar, 0);*
break;
}
}
}
}
}
Wurminator_SwitchPanel.ino (1.39 KB)