Hello, I'm having problem understanding how to plug a shift register to arduino, I would like 16 output with 0/1 state with the fewest pin possible.
Is this one correct for the use I want to do?
If yes, how do I plug in to my arduino ( I have a atmega 1280 )
thank you guys
Using the second diagram with 16 led and that codehttp://arduino.cc/en/Tutorial/ShftOut22 (http://arduino.cc/en/Tutorial/ShftOut22) it will use only 3 pin two control 16 output with 0/1 state. Is that right?
Yes. If you set it up as per example 2 you will have 16 outputs using 3 control pins. Be aware that there is an error in the tutorial. The Capacitor that is shown SHOULD NOT be included. There should be NO capacitor on the latch pin.
The example should give you the basics of how to "Shift" data into the registers and how to format that data.
Once you understand the basics you should be able to modify this code, or write new code, to achieve the effect you are after.
On an advanced note, if you need to shift the information faster there is a method to do this using SPI. But for simple lighting effects the ShiftOut function should be fine.
Thanks for the information, For my project, I will do a 8*8*8 LEDs cube with 8 layer of 8 by 8 LEDs (anode in \\, cathode in \\), then I'll mutiplex two layer of transistors 8*8, one npn and one pnp, so like that I would be able to light each LED one by one by powering one npn and one pnp. So two 74hc595 for the npn, same thing for pnp. Does shift out gonna be enough fast so we can see all LEDs light at the same time? I know it seem complex, I can post a draft schematic.
I haven't done anything with LED Cubes but 8x8x8 means 512 LEDs. All of which have to be multiplexed and updated constantly. It may be that ShiftOut won't be fast enough for that purpose.
There are people on here who have made cubes, maybe one of them could chime in.
I would use SPI.transfer to send data to a cube, way faster than software based shiftout.
Use SCK and MOSI pins, with SS for the shift register latch pin.
digitalWrite (SS, LOW);
digitalWrite (SS, HIGH);