Can't create patterns with 74HC595

I assembled the ShiftOut example's circuit and uploaded the hello world code which should light LEDs according to the number passed.

In my case, it didn't work. ALL LEDs are lighting up at once according to last bit of the passed number - for odd numbers, all LEDs get lit, even numbers make them all off.

Any clue on what I'm doing wrong?

Sounds like you may have connected it wrong, but hard to say!

You should take a look at the Earthshine Design manual, has a VERY good explanation for using 595’s, and also some easier code to understand for using it.

http://earthshinedesign.co.uk/ASKManual/ASKManual.pdf

Forgot which example exactly… but it’s closer to the end. Might as well save the PDF, it’s uber helpful.

Interesting, the PDF you pointed out tells to connect 595's pin 9 to Vcc while the ShiftOut tutorial says I should connect pin 10 to Vcc instead. Wierd... reading IC's documentation, I think tutorial makes more sense.

I wrote my own version of shift out based on what I understood from the datasheet but I’m still cannot create patterns.

Do you see anything wrong with the following code?

int RCLK = 8;
int SRCLK = 12;
int SER = 11;

void setup() {
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);
  pinMode(SER, OUTPUT);
}

void loop() {
  digitalWrite(RCLK, LOW);
  digitalWrite(SRCLK, LOW);
  digitalWrite(SER, LOW);
  for (int i = 0; i < 256; ++i) {
    digitalWrite(RCLK, LOW);
    for (byte j = 0; j < 7; ++j) {
      if (i & (1 << (7-j))) {
        digitalWrite(SER, HIGH);
      } else {
        digitalWrite(SER, LOW);
      }
      digitalWrite(SRCLK, HIGH);
      digitalWrite(SRCLK, LOW);
    }
    digitalWrite(RCLK, HIGH);
    delay(1000);
  }
}

Argh! My bad! I just learned how my breadboard works. Sorry.