help with 74HC595 controlling induvial leds

hi im tinkering around with a 74HC595 chip and i was trying to figure out how to controll induvial leds. all the guides about these chips are just about understanding how it works and not how to program it. I understand how it shifts in data, but I am unable to creat a correct code to turn induvial leds on.

with the code below i was able to turn on led #1 , but when i was unable to turn any single one on…

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}

void loop() {
// count from 0 to 255 and display the number
// on the LEDs
for (int i = 0;i < 2; i++) {
// take the latchPin low so
// the LEDs don’t change while you’re sending in bits:
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin, clockPin,00000001, i);

//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
// pause before next value:
delay(1);

digitalWrite(latchPin, LOW);
}}

shiftOut(dataPin, clockPin,00000001, i);

toss a B in front of 00000001 to tell the compiler that is a Binary representation of the number

shiftOut(dataPin, clockPin,B00000001, i);

So if I wanted to turn just led #8 on I would change B00000001 to B10000000? That's it?

if its wired correctly ... ayep

actually you have the function wrong

shiftOut(dataPin, clockPin, bitOrder, value)

so

shiftOut(dataPin,ClockPin, MSBFIRST (or LSBFIRST), B00000001);

http://arduino.cc/en/Reference/ShiftOut

ok i think i get it now. using this code i was able to turn one leds and make them flash at different intervals.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}

void loop() {
// count from 0 to 255 and display the number
// on the LEDs
for (int i = 0;i < 256; i++) {
// take the latchPin low so
// the LEDs don’t change while you’re sending in bits:
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin,clockPin, MSBFIRST, B01000000);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
delay(500);
digitalWrite(latchPin, LOW);
shiftOut(dataPin,clockPin,MSBFIRST, B00000001);
digitalWrite(latchPin, HIGH);
delay(200);
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,B00000100);
digitalWrite(latchPin, HIGH);
delay(500);

}}

Do you need the for loop ?

Do I need the what?

Do I need the what?

Probably not.