These Lights Were Made for Blinkin'

By: WardCunningham

2010-07-12 07:33:26

Paul has built some nifty demo boards for Teensy and Teensy++ computers that have an LED and push button for every available pin. After struggling through an obscure USB bug, I'm proud to say that I've got these lights a blinkin'.

Txtzyme Teensy Demo from Ward Cunningham on Vimeo.

My laptop orchestrates this performance. I launch the sequencer script with this open-ended shell command which forks as many processes as I have demo boards:

for i in /dev/cu.usbmodem*; do (perl sequence.pl $i &); done

The sequence.pl script uses a new Txtzyme command, v for version, to sense which flavor of Teensy its talking to and then sets up appropriate arrays of pin numbers for the various effects.

Here is an effect I call Twinkle:

putz shuffle(map("$_ 1o 8m",@all), map("$_ 0o 8m",@all));

This uses map to create Txtzyme code to turn on and turn off all of the pins. Each operation is in a short string, something like "6d 1o 8m", which outputs 1 to one pin and then pauses 8 milliseconds. Before I send the mapped collections to the Teensy, I shuffle them together with the handy perl library shuffle routine.

As always, I've pushed this up to a Txtzyme project page on GitHub.

Back to archive index