Simple Arduino - 74hc595 shift register construction [tmli5]
You have a number of problems here. The first is the wiring.



My wiring diagram above is for the Uno / Duemilanove. Since that is what you have, you should follow that.

The pins are fixed in hardware, except for the slave select pin. Thus D13 on the Duemilanove should go to pin 11 on the 595. D11 on the Duemilanove should go to pin 14 on the 595. And your slave select (which may as well be pin 10 on the Duemilanove) should go to pin 12 on the 595.



Your code looks more complex than it needs to be. This code will exercise the 8 LEDs:

#include &lt;SPI.h&gt;

const byte LATCH = 10;

void setup ()
{
  SPI.begin ();
}  // end of setup

byte c;
void loop ()
{
  c++;
  digitalWrite (LATCH, LOW);
  SPI.transfer (c);
  digitalWrite (LATCH, HIGH);
  delay (20);
}  // end of loop




As other responders have said, you should have a current-limiting resistor for each LED. You can't share it like that.

Also the 595 ground (pin 8) should be wired to the Duemilanove ground, not via a resistor.



Reference

Using a 74HC595 output shift register as a port-expander