Hi everyone, I've written a small library to interface the very cheap 74HC595 IC, for expanding the digital outputs of the Arduino, and I think it would be usefull to explain how you can use it.
you can get the library here: http://www.pauloricca.com/index.php?a=blog&idpost=18
Basically the principle is the same as in here: http://www.arduino.cc/en/Tutorial/ShiftOut you can use the same hardware layout described in this tutorial, but as you may notice down below, the code isn't that simple to follow and to replicate.
Using the ExtraOutputs library, all you need to do is to create an instance of the ExtraOutputs class, tell it to which pins the IC's are connected, and how many IC's you have connected to each other: ExtraOutputs extraOutputs(latchPin, clockPin, dataPin, numberOfChips);
Then, when you need to change the state of a pin, just use the digitalWrite function, as if you were dealing with Arduino pins: extraOutputs.digitalWrite(pinNumber, HIGH/LOW);
pin numbers go from 0 to 7 on the first IC, 8 to 15 on the second and so on..
Although it's not compulsory, If you are writing to the IC's very often you might want to add a 0.1uf capacitor from pin 12 to Ground
That's it! :) hope you find it usefull..