keypad 12 rows x 4 columns only works with 10 rows

I tried the easy way since I will not use more than 12 rows, so I swapped ROWS and COLS to solve the problem. Also I changed char keys[ROWS][COLS] from characters to MIDI note numbers, in my case ranging from 26 to 73.
This worked fine. For use with my DAW I have a controller X-touch One. That controller only has a few buttons to program, so I made this 4x12 controller to operate alongside the X-Touch One. It's really great to have it now all finally working.

Thanks JohnWasser! You supply digital nutrients amongst the needy! :slight_smile:

Pim

Final code (on a SparkfunMicro), including debounce:

#include <Keypad.h>
#include <MIDIUSB.h>

const byte ROWS = 4; 
const byte COLS = 12;
 
// Keymap
char keys[ROWS][COLS] = {
  { 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70 },
  { 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71 },
  { 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72 },
  { 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73 } 
};

// Connect keypad to Arduino pins.
byte rowPins[ROWS] = { 21, 20, 19, 18 };
byte colPins[COLS] = { 6, 7, 8, 9, 10, 16, 14, 15, 2, 3, 4, 5 }; 
 
// Create Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void noteOn(byte channel, byte pitch, byte velocity) {
  midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
  MidiUSB.sendMIDI(noteOn);
}

void noteOff(byte channel, byte pitch, byte velocity) {
  midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
  MidiUSB.sendMIDI(noteOff);
}

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.begin(115200);
}

 const unsigned long debounceTime = 25;

void loop(){
    char key = kpd.getKey(); 
      
    if (key){
      
      Serial.println(key);
        noteOn(0, (key), 127);   
        MidiUSB.flush();
            delay(10);
      
        noteOff(0, (key), 127);  
        MidiUSB.flush();
            delay(10);
  }
}