I have created my first LED project with a hand made 4X4 LED matrix. The cathodes are joined horizontally to make the rows and the anodes are joined vertically to make the columns the columns. It is controlled by a shift register with the cathodes (rows) connected to pins 0-3 and the anodes (columns) connected to pins 4-7 of the register controlled from an Arduino Nano.
It all works but I have hit upon a limitation that I have not seen in the various videos and tutorials about making LED matrices so I suspect I am missing something.
This code will light up the bottom left LED which I will call position (0,0).
digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, B00011110 ); digitalWrite(latchPin, HIGH);
This code will light up the LED at position (1,1), so one up and one to the right.
digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, B00101101 ); digitalWrite(latchPin, HIGH);
If I then combine the two as below:
digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, B00111100 ); digitalWrite(latchPin, HIGH);
it of course lights up 4 LEDs: (0,0),(0,1),(1,0) and (1,1).
This feels like a limitation of wiring the LEDs in this way because once you power a row in a given column, you cannot unpower it in subsequent columns or vice versa. i.e. lighting (X,Y) and (A,B) means that you cannot have (X,B) and (A,Y) unlit.
However, in the videos I have seen that accompany tutorials on how to make similarly constructed matrices, I can see them lighting up in ways I can't replicate.
How can I light up an LED at positions (0,0) and (1,1) without also lighting up (0,1) and (1,0)?
Is this possible with this configuration?