■ FIGURE 10. Butterfly Soft SPI Pins.
If the way I’m setting or clearing bits isn’t clear from
earlier Workshops, then I highly recommend that you
refer to a tutorial: [TUT] [C] Bit manipulation (a.k.a.,
“Programming 101”) located at: www.avrfreaks.net/
This will also help when you look at the source code.
I’ll admit to getting confused trying to remember
which pin represented which signal so that I could
properly connect my software SPI signals from each of the
platforms to the 595 and 597. To help with this, you can
refer to Figures 10, 11, 12, and 13, which show the
Butterfly, Arduino, Breadboarduino, and BeAVR40,
respectively, with the soft SPI pins labeled.
Yet Another Cylon Eyes Project
Figure 1 shows the circuit being controlled by an AVR
Butterfly, but the source code is written to run on any of
the devices shown in Figures 10, 11, 12, or 13. The full
program has a bunch of sweep patterns and speeds
selectable from the DIP switch, but here we’ll look at an
excerpt snippet that shows how the plain old Cylon Eye
sweep is run. We first create an array of values that will
■ FIGURE 12. Breadboarduino Soft SPI Pins.
■ FIGURE 11. Arduino Soft SPI Pins.
sweep the lit LED from right to left and then we run that
array forward and backward as shown:
To create a 16 LED Cylon Eye effect
output this array 0 to 15 then 15 to 0
0000 0000 0000 0001 == 0x0001
■ FIGURE 13. BeAVR 40 Soft SPI Pins.