Matrice de Switch on-off-on

Bonjour je suis en pleine réalisation d'une button box et je souhaiterais faire une matrice de switch, bien sur niveau câblage ça passe, mais le problème c'est plutôt niveau codage.Je galère un peu.
Est ce que quelqu'un pourrait m'aider.
Voici le schéma
https://www.noelshack.com/2020-16-1-1586785915-gqhdsctvgsdgfxn.png

Et niveau code voici un apercu sans matrice, avec deux button. Le but est ducoup d'emuler un clavier avec les switchs

/* button box 1.4 beta release */
/*created by Fly The Dream FR */
/* 13/04/2020*/

#include <Keyboard.h>

const int b1 = 12;
const int b2 = 13;




void setup() {
  

  pinMode(b1, INPUT);

  pinMode(b2, INPUT);
  
  Keyboard.begin();
 
}

void loop(){
  //
     if (digitalRead(b1)){
      Keyboard.print("q");
      delay(100);
      Keyboard.releaseAll();
      delay(100);
     
  }
    if (digitalRead(b2)){
      Keyboard.print("b");
      delay(100);
      Keyboard.releaseAll();
      delay(100);
     
  }
}

Hello, I'm in the middle of making a button box and I would like to make a switch matrix, of course the cabling is ok, but the problem is more at the coding level. I'm having a little trouble.
Could someone help me.
Here's the schematic.
https://www.noelshack.com/2020-16-1-1586785915-gqhdsctvgsdgfxn.png

And code level here is a preview above without matrix, with two buttons. The goal is to emulate a keyboard with the switches

You didn't say what the trouble is.

I just said I don't know how to program a switch matrix.