Problem with shift register I have a problem with the shift register 74HC595. 

The sketch I use is able to enable a specific led (8 are connected).

When I enable led 0 to 7 it behaves like normally (they switch on when I enter the numbers).

However, for the led connected to pin 15 (other side of the ic, see layout) it behaves differently.
 When I switch this led on, ALL leds go off. When I retry, nothing happens. When I enable another led, after a short time (but can be seconds) the led for pin 15 is emitting light together with all others which where already enabled.

This seems like a malfunction in the IC (I checked already another led, another cable, another resistor). The only think I haven't checked is moving the IC to another position of the breadboard (that would take a lot of time since I have to rewrite everything). Is it possible I missed something or is the shift register broken?

The code to switch on a led:

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


where leds are the indices of the leds (0..7).
You cannot directly give an index (0..7) to a shift register if you want the index to represent the LED number to be switched on.
You have to build a table similar to the following:

byte led[8] = {
0b00000001,
0b00000010,
0b00000100,
0b00001000,
0b00010000,
0b00100000,
0b01000000,
0b10000000
};


and later . . .

shiftOut(dataPin, clockPin, LSBFIRST, led[leds]);


where leds is a number 0..7