74HC165N shift register with Arduino

Okay, I want to be able to control the 74HC165N shift register with my arduino (I just want to send LOW, HIGH commands to each of the 8 outputs to power LED's), but I am having some trouble looking for a solution online. How would I program this/wire it up? I'm all very new to this, and any help would be greatly appreciated.

Thanks! ;D

Your right to use a shift register but you need one that goes the other direction like the 74HC595. http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MM74HC595N-ND

Are you sure that those will work? I will order them tonight, and do you have possibly a sparkfun link? Thanks!

Absolutely, I just used some to control a multiplexed 7seg 5 digit led module. As long as you don't need more than 35ma per pin which is plenty for 1 led each.

Also look at www.jameco.com because they are probably only 35cents there but the shipping is higher.

Thanks man! I just ordered some. Also, do you think you could send me your code if you are using arduino? Would be INSANELY helpful. :D

This is the Sparkfun link but they are a little steep for individual components like that. http://www.sparkfun.com/commerce/product_info.php?products_id=733

Yupp, that’s exactly what I just got. And yea I just like how fast they ship and IDK they kinda got me into all this stuff so I think they deserve business from me :sunglasses:

Could you send me some code? Please it would be so helpful, feel free to post it for others to, may help them too.

This is the basic function. If you chain more together you just send multiple bytes then latch at the end. You simply tie the pin 9 output of one to the SER of the next one and link all the RCK and SCK lines together.

//SCLR pin 10-high
//G pin 13-low

int SER=8;//data pin
int SCK=9;//clock pin
int RCK=10;//latch pin

void setup(){
  pinMode(SER,OUTPUT);
  pinMode(RCK,OUTPUT);
  pinMode(SCK,OUTPUT);
  digitalWrite(RCK,HIGH);
  digitalWrite(SER,LOW);
  digitalWrite(SCK,LOW);

}

void loop(){
 setByte(255);
 latchData();
 delay(1000);
 setByte(0);
 latchData();
 delay(1000);
  
}

void setByte(int _value){
  for(int i=7;i>=0;i--){
    digitalWrite(SER,((_value>>i)&1));
    digitalWrite(SCK, HIGH);
    digitalWrite(SCK, LOW);
  }
}

void latchData(){
 digitalWrite(RCK, LOW); 
 digitalWrite(RCK, HIGH); 
}

Also if you use the G enable on a PWM pin then you can control brightness.

There's a good tutorial in the EarthshineDesign ASK manual with the 595's. (along with a bunch of others)

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

I suggest you save it to your hard drive, if you were like me when you were starting, you'll read it like a Bible for the first couple weeks. :)

There is also a tutorial on arduino.cc:

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