Shift Register Not Working I am trying to learn how to use a shift register to control 8 LEDs but for some reason my shift register is misbehaving and none of the LEDs are lighting up. I imagine that it's a problem with my wiring? I have replicated the circuit on 123D Circuits.



//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // count from 0 to 255 and display the number 
  // on the LEDs
  for (int numberToDisplay = 0; numberToDisplay &lt; 256; numberToDisplay++) {
    // take the latchPin low so 
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);  

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(500);
  }
}
From the Arduino website:


  shiftOut()
  
  Description
  
  Shifts out a byte of data one bit at a time. [...]
  
  Note: if you're interfacing with a device that's clocked by rising
  edges, you'll need to make sure that the clock pin is low before the
  call to shiftOut(), e.g. with a call to digitalWrite(clockPin, LOW).


You need to pull clockPin low before each shiftOut() call, as the documentation says.

Also, you have misunderstood the behaviour of the latchPin. This can be high or low at any time; it's the change from low to high that latches the data into the output cells.