Problem with 595's cascade

Hey guys, my circuit doesn't work, can someone point me what is wrong here?

I have 5x 595 chips in cascade using above schematic, latch and clock pins are wired in parallel.
There is a led on each QA-QH pin of each chip.

I'm doing some tests with this code

const int latchPin = 8;
const int clockPin = 9;
const int dataPin = 10;

void setup() 
{

  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  
}
  

void loop () 
{
  
    digitalWrite(latchPin, LOW);                       
    shiftOut(dataPin, clockPin, MSBFIRST, B00000100);      
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);      
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);      
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);      
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);          
    digitalWrite(latchPin, HIGH);                      
    delay(1000);  
  
    digitalWrite(latchPin, LOW);                       
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);      
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000); 
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000); 
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000); 
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000); 
    digitalWrite(latchPin, HIGH);                      
    delay(1000);
 
}

I was expecting to get a blinking led for each active bit, but the only one that makes difference is the last bit in the last shiftout(), then I get almost all leds blinking with some random pattern.

I was using a similar code for 7 segments display control, and it worked well, but now it doesn't.

Thanks in advance for any help.

I have 5x 595 chips in cascade using above schematic,

But that schematic shows only one chip. It is the interconnections between the chips we need to see to check if you are doing it right.

Grumpy_Mike:
But that schematic shows only one chip. It is the interconnections between the chips we need to see to check if you are doing it right.

Thanks mate, problem was in the code.

I just changed pins declarations and everything got back to normal

#define latch_pin             8
#define clock_pin             9
#define data_pin             10

Also had to change var names, it seems arduino uses latchPin, clockPin and dataPin as some kind of internal variables.

/solved