I want to make an 8*8 led matrix. I found this code on the web:
int latchPin = 12; //Pin connected to ST_CP of 1st 74595
int clockPin = 13; //Pin connected to SH_CP of 1st 74595
int dataPin = 11; //Pin connected to DS of 1st 74595
int latchPin2 = 6; //Pin connected to ST_CP of 2nd 74595
int clockPin2 = 7; //Pin connected to SH_CP of 2nd 74595
int dataPin2 = 5; //Pin connected to DS of 2nd 74595
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(latchPin2, OUTPUT);
pinMode(clockPin2, OUTPUT);
pinMode(dataPin2, OUTPUT);
}
void loop() {
/************** Send HIGH to first Anode pin (16th pin) and LOW to all
other anode pins (15, 11, 3, 10, 5, 6, 13) of LED matrix *************/
// take the latchPin low so the LEDs don't change while you're sending in bits:
digitalWrite(latchPin, LOW);
//Send 0 0 0 0 0 0 0 1 (1) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
shiftOut(dataPin, clockPin, MSBFIRST, 1);
// shift out the bits:
digitalWrite(latchPin, HIGH);
/**************** Send LOW to the first cathode pin (4th pin) and HIGH to all
other cathode pins (7, 2, 8, 12, 1, 14 and 9) of LED matrix *****************/
// take the latchPin low so the LEDs don't change while you're sending in bits:
digitalWrite(latchPin2, LOW);
// Send 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
shiftOut(dataPin2, clockPin2, MSBFIRST, 254);
// shift out the bits:
digitalWrite(latchPin2, HIGH);
}
I expected this code to turn on the first LED, but when I uploaded this code nothing lights up. I checked my rows and colum connections.
Also, I want to ask if a 74hc595 can output sink current?