It appears the code that I posted had power and grounds reversed, since you say that columns are controlled by the power and the code says that A2 is grounds. Maybe dataPinA_row and dataPinA_col would be better names?
Your code has three arrays of ints named ledMatrixA, ledMatrixB, ledMatrixC and ledMatrixD. It looks like the A and D are identical and the B and C are different.
I don't think it's necessary to store all those values in arrays, since they can be calculated based on row and column. For example, the following reproduces the ledMatrixA array just by bit shifting.
int ledMatrixA[8][9] = {
{B11111110, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B11111101, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B11111011, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B11110111, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B11101111, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B11011111, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B10111111, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001},
{B01111111, B10000000, B01000000, B00100000, B00010000, B00001000, B00000100, B00000010, B00000001}
};
void setup() {
Serial.begin(9600);
byte row, col;
for (byte r = 0; r < 8; r++)
{
row = (1 << r) ^ B11111111;;
Serial.print(row, BIN); Serial.print(", ");
for (byte c = 0; c < 8; c++)
{
col = 1 << (7 - c);
Serial.print(col, BIN); Serial.print(", ");
}
Serial.println();
}
}
void loop() { }
I think if I were working on this I would make an array of the shift register pins like this:
typedef struct {
int rowData;
int rowLatch;
int rowClock;
int colDate;
int colLatch;
int colClock;
} shiftreg;
shiftreg shiftRegPins[] = {{13, 12, 11, 10, 9, 8}, {7, 6, 5, 4, 3, 2}};
Then work out how to calculate a row and column based on the LED array index and write a function to turn on a specific LED given a matrix #, row and column. Multiple columns in a row could be achieved via bit operations.
After that was done I would write the code to handle the patterns associated with the buttons.
BTW, the wiring on your breadboards is a work of art.