Hey there everybody!

After a long time I decided to recover my board from the shelf where it has stayed for years and I discovered I had an SN74HC595, which I didn’t know about.

Long story short, it looked interesting so I code something with a 4-digit 7-segment display (SMA420564). The idea is to have the display to loop from 0000 to 9999. And it works quite nicely, but after 20-30 secs it turns off. No overheating observed. Find attached the code, the wiring schematics and a video of the ‘failure’. Sorry for the messy wiring, I’m quite a noob

Thanks in advance for helping me with this! I’d appreciate any feedback

Cheers!

-G

```
int latchPin=5;
int dataPin=4;
int clockPin=6;
const int digitPin[4]={3,9,10,11}; // PWM outputs that drive the digit pins
const byte digit_pattern[10]=
{
B11111100, // 0
B01100000, // 1
B11011010, // 2
B11110010, // 3
B01100110, // 4
B10110110, // 5
B10111110, // 6
B11100000, // 7
B11111110, // 8
B11110110 // 9
};
unsigned int counter = 0;
int thousand;
int hundred;
int ten;
int one;
int t0=0;
int t1=100; // ms that ellapse before a new number is sent
void setup() {
// put your setup code here, to run once:
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
for (int counter = 0; counter <= 9999; counter++) { //cycles through all numbers
// decompose the number to get the value for each digit
thousand=floor(counter/1000);
hundred=floor((counter-thousand*1000)/100);
ten=floor((counter-thousand*1000-hundred*100)/10);
one=(counter-thousand*1000-hundred*100-ten*10);
int digits[4]={ thousand ,hundred , ten , one};
t0=millis();
while (millis()-t0<=t1) { // if ellapsed time is below t1, don't send a new number
for (int i=0; i <= 3; i++) { //cycles through all 4 digits
digitalWrite(latchPin,LOW); // pulso BAJO
digitalWrite(clockPin, LOW);
shiftOut (dataPin, clockPin, LSBFIRST, digit_pattern[digits[i]]);
digitalWrite(latchPin,HIGH); // pulso ALTO
analogWrite(digitPin[i], 0);
delay(4);
analogWrite(digitPin[i], 255);
}
}
}
}
```