byte
byte
byte
byte
byte
$00, $FF, $08, $01, $00, $00, $00,
$00
$FF, $08, $01, $00, $00, $00, $00,
$00
$08, $FF, $00, $00, $00, $00, $00,
$00
$01, $08, $FF, $00, $00, $00, $00,
$00
$00, $01, $08, $FF, $00, $00, $00,
$00
If you look very closely, you'll see that one element of
each line is full bright ($FF), and the position in the table
creates the scanning effect. Now look again. Here's where
we can make things cool by using a dimmer instead of
straight shifts of a single LED. If you look, you will see the
values $08 and $01 adjacent to the lit LED. Once you see
it in action, the values will make sense. What's happening
here is that we're creating a motion trail on the
downstream side of the moving element. This gives a
richer look to our version of the Larson Scanner, and is
one of those subtle details that people appreciate — even
if they don't know exactly why.
Let's have a look at the demo program. In keeping
with the new version of BSG, when the program starts the
center element will fade on. This is easily handled with a
loop:
repeat level from 0 to 255
bright := leds.ezlog(level)
leds.set(3, bright)
pause(7)
This is simple. We're looping through the brightness of
the LED to create a fade on effect. Note, though, that
we're using a method called ezlog() to modify the value. A
friend showed me this trick for "bending" a linear set of
LED values into a quasi-log curve. What this does is
provide a more natural fade effect when looking at the
LED. The set() method moves a value to a dimmer
channel. After a short hold, we drop into the program
main scanner loop.
repeat
repeat row from 0 to 13
bytemove(leds.address, @cylon[row*8], 8)
pause(100)
The outer repeat causes this loop to run forever; the
inner repeat loops through the DAT table. The only tricky
aspect is moving the table to the modulation object. One
of the methods in that object is called address() which
provides the hub address of the duty cycle array. By
knowing this address, we can use bytemove to copy eight
bytes from the table directly into the duty cycle array. A
short pause is used to control the speed of the animation.
That's it; a cooler version of the ubiquitous Larson
Scanner.
GAME ON!
Now, if you still don't think LEDs are cool, let me tell
SPIN ZONE
you about another aspect of my busy summer. In August, I
traveled to Seattle for the PAX Prime gaming convention.
Honestly, I'm not very much of a gamer, but I love the
technology and programming used in online and console
games. In fact, a lot of the disciplines used in the gaming
industry were born in the visual effects world of the movie
industry.
So, why did I go? Well, I had the incredible good
fortune to be asked by Hollywood FX master, Steve
Wang, to do lighting in characters that he was building for
a display. Steve and his massively talented team took two
characters from the new game, Firefall (from Red 5
Studios), and made them full sized and unbelievably
lifelike. They are so realistic, you expect them to walk
off the platform. Figure 2 is a photo of Steve (lower left
with big brown dog) and most of the build crew. Can you
find me? With us real humans in the photo you get a
sense of the scale of this display; and it was built in just
six weeks!
The characters are phenomenal but can't move, so
Steve asked me to provide lighting control that let us
easily animate the lights on the character for extra pizazz.
This is where the Propeller really shines — no pun
intended. When Steve has a lighting change request, it
doesn't take long to implement using Spin.
To give you an idea, each character controller's
master cog launches the dimmer cog (PASM) and up to
four animation cogs which are all written in Spin. The
state of each of these Spin cogs is stored in a global hub
variable so that the master cog, "listens" for a start
signal from the project master controller. On receiving
the start signal, the master cog runs the show by changing
the various states of the other lighting control cogs. The
neat part is that the lighting cogs are written in Spin
(easy) and as they are, they can access the methods of
the dimmer object that was started by the master cog.
That's right, the dimmer object is being accessed by up to
five cogs.
Figure 3 shows the male character, Typhon, all lit up.
Most of the front lighting pulsates up and down in a
smooth pattern, though the white headlights have an
occasional "twitch" as if there was a loose wire while
moving. Figure 4 is a close-up of Typhon's back. In the
image, you'll see that there are two cylindrical protrusions
JON “JONNYMAC” WILLIAMS
jwilliams@efx-tek.com
PARALLAX, INC.
Propeller chips and programming tools
www.parallax.com
PULSAR PRO FX
PCB Fab-In-A-Box
www.PulsarProFX.com
November 2011 17