20 lines.

The basic police light was revved up a few times faster, with added random sparks, mainly to the unlit sides so they show up better. The dynamo has been dimmed to 35% so the sparks stand out, though we think it could stand more dimming for even more dramatic sparks.

//Generator Overload with sparks
//1 rotation in 195ms (5 per second)
//Random sparks can occur in all four phases

phase4
@45ms  chn4 = fade from 35% to 1% for 45ms //west,chn4 dark 
       chn1 = fade from 1% to 35% for 45ms //North,chn1 peaks 
@60ms  Go To phase1 with 95% chance
       chn2 = 100%                
phase1
@90ms  chn1 = fade from 35% to 1% for 45ms //North,chn1 dark 
       chn2 = fade from 1% to 35% for 45ms //east,chn2 peaks 
@105ms Go To phase2 with 85% chance
       chn3 = 100%
phase2
@135ms chn2 = fade from 35% to 1% for 45ms //east,chn2 dark 
       chn3 = fade from 1% to 35% for 45ms //south,chn3 peaks
@150ms Go To phase3 with 95% chance
       chn4 = 100%
phase3
@180ms chn3 = fade from 35% to 1% for 45ms //south,chn3 dark
       chn4 = fade from 1% to 35% for 45ms //west,chn4 peaks
@195ms Go To phase4 with 85% chance
       chn1 = 100%    

       //falls through, replays              

Building on the Concept

This next version took it quite a bit farther. It was inspired in part by the first episode, first season of the TV series Lost. Remember the menacing jet engine that wouldn’t stop rising and falling RPM’s after the crash?  This is our interpretation. And we called ours a generator.

This generator revs up, then sparks appear and the unit loses power, slowing back down again. The revving up and down have some randomness so they don’t duplicate exactly.

Three more LED’s make a battery gauge style bargraph that indicates the RPM level: 3 LED’s on at high RPM, down to no LED’s on at low RPM. It really works.

Another three LED’s form a kind of needle gauge where only one is on at a time for high – medium – low. The high LED is shared between both indicators, squeezing the total LED count to 9.

We threw in a starter sequence, like a gas engine electric starting. Wish we had more time to revise this portion, then again, it only gets seen for the first few seconds.

The code listing is too long for this page but the download is here. Unzip and view in Sequence Composer:

 Generator-Overload-with-Sparks-Speedup-Bargraph.zip