//**************************************************************//
// Name : shiftOutCode, Hello World //
// Author : Carlyn Maw,Tom Igoe //
// Date : 25 Oct, 2006 //
// Version : 1.0 //
// Notes : Code for using a 74HC595 Shift Register //
// : to count from 0 to 255 //
//****************************************************************
//Pin connected to ST_CP of 74HC595
intlatchPin=8;//Pin connected to SH_CP of 74HC595
intclockPin=12;////Pin connected to DS of 74HC595
intdataPin=11;voidsetup(){//set pins to output because they are addressed in the main loop
pinMode(latchPin,OUTPUT);pinMode(clockPin,OUTPUT);pinMode(dataPin,OUTPUT);}voidloop(){//count up routine
for(intj=0;j<256;j++){//ground latchPin and hold low for as long as you are transmitting
digitalWrite(latchPin,LOW);shiftOut(dataPin,clockPin,LSBFIRST,j);//return the latch pin high to signal chip that it
//no longer needs to listen for information
digitalWrite(latchPin,HIGH);delay(1000);}}