Matrix for toggle (on, off) switches for keyboard emulator

Using a pro micro I’m trying to make a keyboard emulator diy racing wheel using:
• 2 toggle switches
• 8 toggle (on, off) push buttons (same as toggle switches)

//and eventually including
• 8 rotary encoders
• 2 micro switches

I’m having trouble making a matrix for the 10 toggle switches/ buttons as to prevent them sending continuous keystrokes. I have to use StateChangeDetection (I think) which I can get to work using individual pins (but that takes up to many pins) but don’t know how to make a matrix using StateChangeDetection,

and then I’m facing how to use encoders as aswell but I’ll deal with that at a later date

I have to use StateChangeDetection (I think)

Yes, you do.

which I can get to work using individual pins (but that takes up to many pins)

How are the switches actually connected, then? Without knowing that, and what you mean by matrix, no one can help you write code.

If you have a matrix of 8 switches, arranged say as 2 rows of 4 you can use the Keypad library to read 8 keys using 6 pins. We do, however, need more details of how the switches are connected

using:
• 2 toggle switches
• 8 toggle (on, off) pushbuttons (same as toggle switches)

Switches can be a toggle, or push button (or other in rare cases).
I think you need is to handle your momentary action pushbuttons in a latching function - as opposed to the switch doing the work for you.

MOMENTARY PUSHBUTTON: Push-on / Release off.

  • not -
    LATCHING PUSHBUTTON: Push-on / latch / Push off.