daisy chaining shift registers

Usually I can stitch something together from what I can find on the internets…
Not this time. I might be too dense. I’m happy to pay for code modifications.
The code and wiring I am using is from an Adafruit tutorial
The wiring is as follows

Everything I can find alludes to how to make it work to switch more than 8 bits. I need it spelled out,apparently.

I would like to get 12 leds to turn on in sequence then dim out in unison.
any help appreciated.

/*
Adafruit Arduino - Lesson 4. 8 LEDs and a Shift Register - Brightness
*/

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
int outputEnablePin = 3;

int leds1 = 0;
int leds2 = 0;

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(outputEnablePin, OUTPUT); 
}

void loop() 
{//delay initial on
  setBrightness(255);
  leds1 = 0;
  leds2 = 0;
  updateShiftRegister();
  delay(500);
    for (int i = 0; i < 8; i++)

  {//chase speed
    bitSet(leds1,i );
       bitSet(leds2, i);

    updateShiftRegister();
    delay(500);
  }
      for (byte b = 255; b > 0; b--)
  {//fade time
    setBrightness(b);
    delay(5);
  }
}

void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, MSBFIRST, (leds1>>8));
   
      shiftOut(dataPin, clockPin, MSBFIRST,leds2 );

   digitalWrite(latchPin, HIGH);
}

void setBrightness(byte brightness) // 0 to 255
{
  analogWrite(outputEnablePin, 255-brightness);
}

ada_dim_reg.ino (833 Bytes)

   shiftOut(dataPin, clockPin, MSBFIRST, (leds1>>8));
   
      shiftOut(dataPin, clockPin, MSBFIRST,leds2 );

shiftOut()
Description

Shifts out a byte of data one bit at a time.

So, it makes little sense to call shiftOut() with integers. It makes little sense to put data in the low order byte, and then shift the data off the end.

If you are going to use ONE int to hold the data, you should use highByte() and lowByte() to get the bytes to pass to shiftOut().

Sorry.
This is the original code.
I was trying to modify it.

/*
Adafruit Arduino - Lesson 4. 8 LEDs and a Shift Register - Brightness
*/

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
int outputEnablePin = 3;

byte leds = 0;

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(outputEnablePin, OUTPUT); 
}

void loop() 
{
  setBrightness(255);
  leds = 0;
  updateShiftRegister();
  delay(500);
  for (int i = 0; i < 8; i++)
  {
    bitSet(leds, i);
    updateShiftRegister();
    delay(500);
  }
  for (byte b = 255; b > 0; b--)
  {
    setBrightness(b);
    delay(50);
  }
}

void updateShiftRegister()
{
   digitalWrite(latchPin, LOW);
   shiftOut(dataPin, clockPin, LSBFIRST, leds);
   digitalWrite(latchPin, HIGH);
}

void setBrightness(byte brightness) // 0 to 255
{
  analogWrite(outputEnablePin, 255-brightness);
}

I think I’d try it like this

/*
Adafruit Arduino - Lesson 4. 8 LEDs and a Shift Register - Brightness
 */

int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
int outputEnablePin = 3;

byte leds = 0;
byte sequence[] = {
  0x0001, x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800,
};

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  pinMode(outputEnablePin, OUTPUT); 
}

void loop() 
{
  setBrightness(255);
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, highByte(sequence[i]));
  shiftOut(dataPin, clockPin, LSBFIRST, lowByte(sequence[i]));
  digitalWrite(latchPin, HIGH);

  delay(500);
  for (int i = 0; i < 12; i++)

    for (byte b = 255; b > 0; b--)
    {
      setBrightness(b);
      delay(50);
    }
}

void setBrightness(byte brightness) // 0 to 255
{
  analogWrite(outputEnablePin, 255-brightness);
}

Might need some rearranging to have the fade out happen at the right time.

Ack, that loop() is awful now that I look at it again.
Should have been more like this

void loop() 
{
// full brightness
    analogWrite(outputEnablePin, 255);

// walk 1 LED on across the display
  for (int i = 0; i < 12; i++){
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, highByte(sequence[i]));
    shiftOut(dataPin, clockPin, LSBFIRST, lowByte(sequence[i]));
    digitalWrite(latchPin, HIGH);

    delay(500);
  }
// fade out
  for (byte b = 255; b > 0; b--)
  {
    analogWrite(outputEnablePin, b);
    delay(50);
  }
}

Or this sequence if you want to light them all up

byte sequence[] = {
  0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff,
};

The last 4 values in your array are larger than a byte.

Oops, that should have been int:

int sequence[] = {
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff,
};

highByte and lowByte would work better that way too.

Thank you so much for your input.
I still need to learn how to use multiple shift registers.
I ended up using a Mega boards 12 PWM pins to make the lights dance.

Again, thanks.