Led cube 74HC595

My question is how to write code to manage layers using the 74HC595?
Here we assume the code in which the layers are connected to the Arduino and I have to manage layers using the 74HC595

int data  = 4; // HC595-1, 2
int clock  = 5; // HC595-1, 2
int latch  = 6; // HC595-1, 2

int layerPin[] = {

int data8x8[] = {
 0, 0, 0, 0, 0, 0, 0, 0}

void setup(){
 pinMode(data, OUTPUT);
 pinMode(clock, OUTPUT);
 pinMode(latch, OUTPUT);

 for (int i = 0; i < 4; i ++){
   pinMode(layerPin[i], OUTPUT);

void loop(){
 for (int z = 0; z < 4; z++){
   for (int y = 0; y < 4; y++){
     for (int x = 0; x < 4; x++){
       int xbijy= y*4 + x;
       int shiftReg = z*2+ xbijy / 8;
       int bitNr = xbijy % 8;
       data8x8[shiftReg] = 1<<bitNr;

void drawCube(int duur){
 for (int t = 0; t <  duur; t++){
   for (int zz=0; zz < 4; zz++){
     shiftOut(data, clock, LSBFIRST, data8x8[zz*2]);
     shiftOut(data, clock, LSBFIRST, data8x8[zz*2 + 1]);

You obviously did not read this before posting a programming question or if you did you ignored the advice to put code tags round code to avoid it being interpreted as HTML. Look at your code as posted. Much of it is in italics. Edit your post, select the code and click on the </> icon above the editor to insert [­code­][­/code­] tags

I wrote some cube management software recently, one aspect of which was using the '595 to control layers and LEDs in the layer. Looking at that code may help you, and you should read the documentation that comes with it. Link to the libraries repository in my signature block, below.

I'm not programming. That code that you constantly have an error. I need to explain what should be added to make the code I wrote above.

I doubt will get much help unless you can post a circuit as the software specifically drives your arrangement.

Hello! The question is, there are two 74HC595 whose total ST and SH but different DATA. As in the code to control each register separately for the inclusion of LEDs?