One 74595 is directly connected to the anodes.
The second one is connected to the base of 8 2N3904 NPN transistors that are connected to the ground through a 150 Ohm resistor on the emitter and the collector is connected to the 8x8 matrix cathodes.
int latchPin2 = 5; //74595 connected to ANODES
int latchPin = 4; //74595 connected to CATHODES
int clockPin = 2; //Shared clockPin, but under this troubleshooting the clockpin is only connected to the anode controlling 74595
int dataPin = 3; //Shared dataPin, but under this troubleshooting the datapin is only connected to the anode controlling 74595
byte data;
byte dataArray[8]; //Array to set the leds
void setup() {
Serial.begin(9600);
pinMode(latchPin2, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.println("Ready");
dataArray[0] = 1; //Tried hexadecimal so I've now tried just normal decimals.
dataArray[1] = 2;
dataArray[2] = 4;
dataArray[3] = 8;
dataArray[4] = 16;
dataArray[5] = 32;
dataArray[6] = 64;
dataArray[7] = 128;
}
void loop() {
for(int i = 0; i < 8; i++) {
data = dataArray[i];
digitalWrite(latchPin2, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, data);
digitalWrite(latchPin2, HIGH);
Serial.println(i, DEC);
delay(2500);
}
}
It works just fine when running the 0x0F / 0xF0 hex array, but with every other combo every second array doesn't light up. It only shows 0, 2, 4, 6 or 1, 3, 5, 7. And it seems totally random which it will show, I'm a bit confused about this.