Custom keyboard

Not necessary I could use the ubs hub if I have 5 arduino mini pro :joy:

is not suitable to work as HID keyboard

´Micro pro’

you will have hard time to exhaust 1 single micro pro due to shift registers and multiplexers

How do I do it then?

daisy chain shift registers (74hc165), its inputs connect with pulled up switches and buttons;

potentiometers connect to multiplexers (74HC4067)


or PCF8575(wait, this one is not analog input featured)

We must not forget that I have 74 buttons

no encoders?

Can't I use a key map?

what is key map?

It’s this

That way I could use a multiplexer for 64 buttons

#include <Arduino.h>
#include <CD74HC4067.h> // Bibliothèque pour utiliser le multiplexeur CD74HC4067
#include <HID-Project.h> // Bibliothèque pour créer un périphérique HID

// Définir les broches de sélection du premier multiplexeur
CD74HC4067 mux1(2, 3, 4, 5); // S0, S1, S2, S3 pour le premier multiplexeur

// Définir les broches de sélection du deuxième multiplexeur
CD74HC4067 mux2(6, 7, 8, 9); // S0, S1, S2, S3 pour le deuxième multiplexeur

// Déclaration des touches associées aux boutons (74 boutons au total)
const uint8_t buttonKeys[74] = {
  // Multiplexeur 1 (62 boutons)
  CMD_PROG, CMD_PERF, CMD_INIT, CMD_DATA, CMD_FPLN, CMD_RAD_NAV, CMD_FUEL_PRED, CMD_SEC_FPLN,
  CMD_ATC_COMM, CMD_MCDU_MENU, CMD_BRT, CMD_DIM, CMD_FPLN, CMD_RAD_NAV, CMD_FUEL_PRED, CMD_SEC_FPLN,
  CMD_ATC_COMM, CMD_MCDU_MENU, CMD_BRT, CMD_DIM,
  CMD_1, CMD_2, CMD_3, CMD_4, CMD_5, CMD_6, CMD_7, CMD_8, CMD_9, CMD_0, CMD_SLASH, CMD_SP, CMD_CLR,
  CMD_A, CMD_B, CMD_C, CMD_D, CMD_E, CMD_F, CMD_G, CMD_H, CMD_I, CMD_J, CMD_K, CMD_L, CMD_M, CMD_N,
  CMD_O, CMD_P, CMD_Q, CMD_R, CMD_S, CMD_T, CMD_U, CMD_V, CMD_W, CMD_X, CMD_Y, CMD_Z,
  CMD_FLT_NBR, CMD_IN_USE, CMD_OPTIONS, CMD_RETURN, CMD_FMGC, CMD_ATSU, CMD_AIDS, CMD_CFDS,
  CMD_V1, CMD_V2, CMD_V3, // Les trois boutons sans nom
  // Multiplexeur 2 (12 boutons)
  CMD_L1, CMD_L2, CMD_L3, CMD_L4, CMD_L5, CMD_L6, // Boutons à gauche
  CMD_R1, CMD_R2, CMD_R3, CMD_R4, CMD_R5, CMD_R6  // Boutons à droite
};

void setup() {
  Serial.begin(115200);
  mux1.begin();
  mux2.begin();
  // Initialiser le clavier HID
  Keyboard.begin();
}

void loop() {
  // Gestion des boutons du premier multiplexeur
  for (int buttonIndex = 0; buttonIndex < 62; buttonIndex++) {
    mux1.channel(buttonIndex);
    int buttonState = digitalRead(mux1.getPin());
    if (buttonState == LOW) { // Bouton pressé
      Serial.print("Button pressed: ");
      Serial.println(buttonIndex);
      // Envoyer la touche associée via HID
      Keyboard.press(buttonKeys[buttonIndex]);
      delay(100); // Petit délai pour éviter les rebonds
      Keyboard.releaseAll();
    }
  }

  // Gestion des boutons du deuxième multiplexeur
  for (int buttonIndex = 0; buttonIndex < 12; buttonIndex++) {
    mux2.channel(buttonIndex);
    int buttonState = digitalRead(mux2.getPin());
    if (buttonState == LOW) { // Bouton pressé
      Serial.print("Button pressed: ");
      Serial.println(62 + buttonIndex);
      // Envoyer la touche associée via HID
      Keyboard.press(buttonKeys[62 + buttonIndex]);
      delay(100); // Petit délai pour éviter les rebonds
      Keyboard.releaseAll();
    }
  }
  
  delay(100); // Petit délai pour éviter les rebonds
}

Tins good this code ?

idk. it is not mine.

I did it but I can't test

Did what ?

I want to create this:

Inside there are 74 buttons and a screen, what I wanted to know is how to do so that I can use buttons to make personalized keys.

examine this

I looked at the 4 examples but nothing corresponds to what I want.

I want to make basic keyboard shortcuts like for example ALT+CTRL+A.

I want each button to be a name for example FMC_A