ShiftOut question for circ05

Ive been playing about with the circuit and code that came with my uno on

I have the circuit set up as it is but in order to get a better idea of whats going on with the shift register I altered my loop() to

int delayt=1000;


void updateLEDs(int value){
  digitalWrite(latch, LOW);     //Pulls the chips latch low
  shiftOut(data, clock, MSBFIRST, value); //Shifts out the 8 bits to the shift register
  digitalWrite(latch, HIGH);   //Pulls the latch high displaying the data

When this activates my first 2 leds light up but if I change updateLEDs to 4 the 3rd led lights up and all the others are off. If its 5 the 1st and the 3rd light by themselves and 6 leds 2 and 3 light up. What is happening in shiftout that has this effect? Why do the lights have this pattern, if the shift register simply pushes the bit from each output to the next wouldnt a value of 6 light up the 6th led?

Yes this is what is supposed to happen. The LEDs are lighting up in the binary representation of the number you are passing to the updateLED function.

Why is that odd? 0 = B00000000 1 = B00000001 2 - B00000010 3 = B00000011 4 = B00000100 5 = B00000101 6 = B00000110 7 = B00000111 8 = B00001000

If you only want 1 LED, then you need to shift in values that have 1 bit high. B00000001 = 1 B00000010 = 2 B00000100 = 4 B00001000 = 8 B00010000 = 16 B00100000 = 32 B01000000 = 64 B10000000 = 128