For kicks, I've extended the basic Arduino shift register LED control example
CIRC-05 from www.oomlout.com to use the Arduino's hardware SPI routines instead of software signalling.
As someone who has done very little with low-level electronics and who didn't know what SPI even was until today, this was embarrassingly easy. Kudos to the excellent Arduino libraries and the great documentation for making this simple.
I'm posting the re-written example for
CIRC-05 here. It has the original software-based control as well as support for SPI, so you can see how similar the methods are.
(BTW, if you were wondering what a "latch" is in the IC, see this example.)
The only change required to the example circuit is that you must use pins 11 and 13 instead of pins 2 and 3, as the Arduino hardware SPI support has MOSI locked to pin 11 and CLK locked to pin 13. It also uses pin 12 for MISO, but we're not using that in this example.
Use output 11 where the wiring diagram says use output 2, and use output 13 instead of 3. No other changes are required.
The actual circuit on the breadboard is not altered in any way.
Here's the sketch code:
Thanks for writing this. It really helps with my project.ReplyDelete