Experimenting with 74hc595's

I am working on the shiftout tutorial (http://arduino.cc/en/Tutorial/ShiftOut) and i have daisy chained two registers and i am using this sketch :

//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 9;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;

char inputString[2];

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
}

void loop() {
  // iterate over the 16 outputs of the two shift registers
  for (int thisLed = 0; thisLed < 16; thisLed++) {
    // write data to the shift registers:
   registerWrite(thisLed, HIGH);
    // if this is not the first LED, turn off the previous LED:
    if (thisLed > 0) {
      registerWrite(thisLed - 1, LOW);
    } 
    // if this is  the first LED, turn off the highest LED:
    else {
      registerWrite(15, LOW);
    } 
    // pause between LEDs:
    delay(250);
    delay(250);
  }

}

// This method sends bits to the shift registers:

void registerWrite(int whichPin, int whichState) {
  // the bits you want to send. Use an unsigned int,
  // so you can use all 16 bits:
  unsigned int bitsToSend = 0;    

  // turn off the output so the pins don't light up
  // while you're shifting bits:
  digitalWrite(latchPin, LOW);

  // turn on the next highest bit in bitsToSend:
  bitWrite(bitsToSend, whichPin, whichState);

  // break the bits into two bytes, one for 
  // the first register and one for the second:
  byte registerOne = highByte(bitsToSend);
  byte registerTwo = lowByte(bitsToSend);

  // shift the bytes out:
  shiftOut(dataPin, clockPin, MSBFIRST, registerTwo);
  shiftOut(dataPin, clockPin, MSBFIRST, registerOne);

  // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
}

However i am having a hard time wrapping my head around the whole shift out process as whole. One specific question i have is this: the example flashes one LED on at a time (very dimly and very briefly). I made a change in the code expecting to turn one LED off at a time:

for (int thisLed = 0; thisLed < 16; thisLed++) {
  
    registerWrite(thisLed, LOW);
    if (thisLed > 0) {
      registerWrite(thisLed - 1, HIGH);
    } 
    else {
      registerWrite(15, HIGH);
    } 
    delay(250);
  }

Instead, the output is essentially the same as the standard example except each led is brightly lit and immediately turns on after the previous turns off, (minimal 'flashing' appearance). IMO It works better then the example but definitely doesn't do what I would expect, that is sequentially turning one LED off. Suggestions or explanations, anyone?

Tutorial on using shift registers.

Tutorial was very informative. However, it uses an extra pin to run the second shift registers and i would like to utilize the daisy-chaining ability of the 595. How Could I do this? here is my code:

int data = 11; 
int clock = 12;
int latch = 8;

byte displayData [ ] = { B01111111, B10111111, B11011111, B11101111, B11110111, B11111011, B11111101, B11111110 }; 

void setup()
{
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);  
  pinMode(latch, OUTPUT);  
  Serial.begin(9600);
}

void loop()                     
{
  
  for(int i = 0; i < 8; i++)
  {
    shiftOut(data, clock, MSBFIRST,displayData[i] );
    digitalWrite(latch, HIGH);
    delay(125);
    digitalWrite(latch, LOW);
  }
 }

The following code snippet handles two shift registers but I just can't make sense of it. Can anyone help decipher it for me

void registerWrite(int whichPin, int whichState) {
  // the bits you want to send. Use an unsigned int,
  // so you can use all 16 bits:
  unsigned int bitsToSend = 0;    

  // turn off the output so the pins don't light up
  // while you're shifting bits:
  digitalWrite(latchPin, LOW);

  // turn on the next highest bit in bitsToSend:
  bitWrite(bitsToSend, whichPin, whichState);

  // break the bits into two bytes, one for 
  // the first register and one for the second:
  byte registerOne = highByte(bitsToSend);
  byte registerTwo = lowByte(bitsToSend);

  // shift the bytes out:
  shiftOut(dataPin, clockPin, MSBFIRST, registerTwo);
  shiftOut(dataPin, clockPin, MSBFIRST, registerOne);

  // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
}

what is bitWrite and how does the sketch determine highbyte and lowbyte?

This http://www.sqlskills.com/blogs/paulselec/post/Arduino-cascading-shift-registers-to-drive-7-segment-displays.aspx explains how to daisychain registers.

"To daisy-chain 595s together is really simple - connect the serial output (pin 9) of the 'lowest' 595 to the serial input (pin 14) of the next one in the chain, and connect all the latch (pin 12) and clock (pin 11) inputs together. When the first 595 accepts a new bit, the highest bit in the register will be pushed out of it's serial line as input to the next 595 in the chain. Enough bits must be pushed to fill all the 595s with new data correctly."

"Care must be taken to push the 8-bit values in the correct order - the 8 bits for the 595 furthest from the Arduino must be pushed first, and the 8 bits for the 595 nearest the Arduino in the chain must be pushed last."

HighByte() "Extracts the high-order (leftmost) byte of a word"
lowByte() "Extracts the low-order (rightmost) byte of a variable (e.g. a word)"
So, the High and Low Byte functions in the sketch you have, split the variable into two to make sure they are sent in the correct order to the shift registers.

I'm having a really hard time understanding all the bit math going on here. What I want is to turn one LED off at a time and then back on. I haven't come across any examples that seem to fit the bill. What I know is that I need pass a totally of 16 bits. I wish i could use this:
byte displayData [ ] = { B01111111, B10111111, B11011111, B11101111, B11110111, B11111011, B11111101, B11111110}; but only holds 8 bits per slot.
feeling stuck, Advice anyone?

seanz2003:
I'm having a really hard time understanding all the bit math going on here. What I want is to turn one LED off at a time and then back on. I haven't come across any examples that seem to fit the bill. What I know is that I need pass a totally of 16 bits. I wish i could use this:
byte displayData [ ] = { B01111111, B10111111, B11011111, B11101111, B11110111, B11111011, B11111101, B11111110}; but only holds 8 bits per slot.
feeling stuck, Advice anyone?

If using that method, instead of using the high/lowByte function put those values into High and Low byte variables before sending them out to the registers (you can call them whatever you want, but remember to send them in the correct sequence).
eg highByte = displaydata[0] lowByte = displaydata[1]

Thank you Lakes! That was the piece that made it all come together.