The first thing I'll make note of is the Serial.begin setting you are using.
Serial.begin(500000); // not a normal value. Is this really what you want?
From the Arduino code reference page:
Serial.begin()
DescriptionSets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200.
The default is generally; Serial.begin(57600);
The second problem is your use of findInList(encA) is incorrect. I see that you are assigning integers to the keymap which might work if you would assign something other than the ASCII control codes. Using the numbers you provided in your keymap and comparing them to the ASCII chart you get the following:
8 backspace
9 horizontal tab
10 line feed
11 vertical tab
12 form feed
13 carriage return
14 shift out
15 shift in
16 data link escape
17 device contro 1
18 device contro 2
19 device contro 3
20 device contro 4
21 negative acknowledge
22 synchronous idle
23 end of trans. block
24 cancel
25 end of medium
26 substitute
27 escape
28 file separatorYour keymap "number" is on the left which defines the ASCII char on the right.
None of those characters are searchable using the version of findInList(char keyChar). So it seems you are then trying to search the list using the other version of findInList(int keyCode). But the numbers you are entering are NOT the keyCode's. The keyCode's are automatically assigned behind the scenes like thus:
//Define Button Matrix Options and Pin Map
byte PSE9[PSE9r][PSE9c] = {
{ 8, 9, 10, 11, 12, 13, 14}, // assigned keyCodes are { 0, 1, 2, 3, 4, 5, 6}
{ 21, 15, 16, 17, 18, 19, 20}, // assigned keyCodes are { 7, 8, 9, 10, 11, 12, 13}
{ 22, 23, 24, 25, 26, 27, 28} // assigned keyCodes are {14, 15, 16, 17, 18, 19, 20}
};
byte PSE9rPins[PSE9r] = { 22, 21, 20}; //row pinouts
byte PSE9cPins[PSE9c] = { 19, 18, 17, 16, 15, 14, 13}; //column pinouts
Hope that helps.