Wiring up a 595 shift register properly

I’m trying to use a shift register to display numbers on my 7 segment display. My Arduino is from Adafruit, so I’m using the shift register tutorial inside the Oomlut guide. However, the shiftOut tutorial uses a different wiring diagram. I’ve set up the 595 according to the Arduino.cc tutorial, but still nothing.

Is there something wrong with my program? I want to eliminate it before looking at the wiring again.

int data = 11;
int clock = 9;
int latch = 8;
int i;
int ledPin = 13;
int numbers[5] = {B11110000, B00110100, B01010100, B01001010, B00000001};
boolean state = true;

void setup() {
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(latch, OUTPUT);
  pinMode(ledPin, OUTPUT);

void loop() {
  int delaytime = 200;
  for (i=0; i<7; i++); {
    shiftOut(data, clock, MSBFIRST, 256);
    digitalWrite(latch, HIGH);

your for loop goes 7 counts, you have 5 elements in an array that you never use, where does 256 come from in the shift out function and why are you using the led on 13

Agreed. All you did was shift out "256" 7 times, and never even used that array of numbers (which is what I suppose you wanted to do).

I imagine that all LEDs (or whatever else you have connected) would be full on with that setup.

Thanks for the messages. I had 256 because I just wanted output on all ports so I could know that it was working.

I've since figured it out (I had voltage to the wrong port) so now I'm trying to map segments to digits. I've been able to output specific elements, but some bytes output on 2 segments. If I make single bits 1, only 1 segment is lit, but then when I add a second bit, 3 elements light up. I don't understand it.

For example, B00000101 lights up 3 elements, but B00000100 only lights 1.

Ok so I've got it mostly figured out. I had a resistor on the main supply line hoping to reduce LED brightness. Since the 595 wasn't receiving 5V completely, the logic circuits were a little messed up.

The only thing I'm doing now is trying to find the right time delay between sweeps so that the LEDs are clear and don't blend together.

Not to zombify an old thread, but why are you shifting out 256? That's B100000000 (9 bits). I think you'd want to shift out 255, which is B11111111 (8 bits).


I've used the HEF 4794 and the 595, the HEF can drive more LED's per pin without a transistor otherwise they're the same.