Button box using Joystick.h library last 3 buttons not working.


I am currently working on a button box project. It all seems to work, but while my code looks fine, the last 3 buttons do not seem to work.
I tested the buttons physically and they are giving signal when pressed.

I have wired the buttons up as you can see in the wiring image.

The code is as following:

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

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

//define the symbols on the buttons of the keypads
byte buttons[NUMROWS][NUMCOLS] = {

byte rowPins[NUMROWS] = {6,5,4,3,2}; //connect to the row pinouts of the keypad
byte colPins[NUMCOLS] = {7,8,9,10,11,12}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS);

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_JOYSTICK, 34, 0, false, false, false, false, false, false, false, false, false, false, false);

void setup() {

void loop() { 

void CheckAllButtons(void) {
      if (buttbx.getKeys())
       for (int i=0; i<LIST_MAX; i++)   // Scan the whole key list.
           if ( buttbx.key[i].stateChanged )   // Only find keys that have changed state.
            switch (buttbx.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
                    case PRESSED:
                    case HOLD:
                              Joystick.setButton(buttbx.key[i].kchar, 1);
                    case RELEASED:
                    case IDLE:
                              Joystick.setButton(buttbx.key[i].kchar, 0);

As you can also see on the attached image, the top 2 rows are 6 columns, the bottom 3 are 5 columns.
I am not complaining about the buttons that are not in that place, as they cannot be pressed.
It is the last 3 buttons that do not give any input while they should.

Thank you in advance for any help.

Best regards,

The Keypad library gets confused if you use the character value zero which is reserved to mean NO_KEY. To get the index in the table, just use '.kcode' instead of '.kchar'. Then the actual key values don't matter as long as they are all unique and none of them are zero.