Testing a Matrix .... with a code... <---- After I check all the pins. First. I don't use a code. I use 1 470 ohm resistor, +5 V, gnd, some wires. I connect the 5 V to a resistor, a wire to a led pin, and a wire to a another led pin to gnd. I move the resitor wire to EACH pins to see a light. If not, I reversed the polarity, do the same procedure until I see a led on. If found, check for a commun pin <-- A CC or CA. Than I know the polarity, I check every pin for each leds. I marked down the led pin on paper.