mstanley:
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:
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:
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.
Yes that helps a TON.
The Serial thing is that I just assigned a baud rate that was listed in the Arduino Serial Monitor.. The Serial outputs are really just for testing and will not be used in the final program.. I raised it thinking the serial output was missing some information output at times in regard to the loop and/or slowing it down and therefore I was missing something. that was causing outputs through the serial to be unexpected.
I DID NOT know how the keyCodes were assigned and therefore was missing that crucial information so now it makes complete sense as to why findInList would always return -1 since 27 and 28 are not in the KeyCodes.. I should now be able to actually find the correct buttons in the Matrix via the keyCode.
I really had no IDEA which version of the findInList was being called but I figured that it was the KeyCode version when changing the variable to a char was outputting the odd symbol. I just didn't know HOW the keyCodes were actually determined and that was going to be my next question but you answered it in your response..
I really do appreciate the time you have put into in helping me understand how this works.
Brion Sohn