These are simple sequences that can be used without reading the text. But they also provide a great way to introduce some new concepts. This page presents:

  1. A one-second tick                                           (and how long replays really take)
  2. A basic 60-second countdown
  3. How one sequence can “turn off” another (and how Theme Designer ties them together)
  4. A 60-minute countdown                               (and how sequences can exceed the 5min 27sec limit)

A One-Second Tick

Very simply, this is a blinking progress indicator that blinks every second. Later, we will combine this with the countdown clocks.

 //One-second tick
@0ms      chn1 = fade from 0% to 100% for 100ms //incandescent On
@500ms    chn1 = fade from 100% to 0% for 100ms //incandescent Off
@995ms    //takes 1 more tick to replay

It gets into one very minor detail about replays: They occur one time stamp count after the sequence ends, which adds 5ms (0.005s) to the total playing time. That never mattered before, but this time we want two sequences to replay on the same time count, so we ended this one at 0.995s and it will replay at 1.000s, 2.000s, etc.

A Basic 60-second Countdown

This countdown is a cross between a bargraph and a counter. Think of a 6-digit odometer starting at 999,999 counting backwards until it reaches zero. The value of each “digit” is depicted as a brightness, starting at 9 (brightest) and counting down to 0 (off). The leftmost digit zeroes out first, followed by the others, each in turn. We made all digits take equal time, but that could be changed to odometer-like speedup of the lower digits.

The maximum time stamp is 5 minutes, 27 seconds. With 6 digits, that’s a maximum of 50 seconds per digit. As listed here, each digit counts down in just 1 second. Once satisfied with the operation, slow it down by changing the following define:

define timePerBar 1s     //examples: 1s is a quick 6 second countdown, 10s is 1min total

Two more functions are described after the listing.

//6 LED Countdown 60-seconds + 1 Explosion
//Looks like an odometer or 6 bar bargraph fading

//A nice touch would be a second custom sequence with a 1-second tick:
//Copy and paste the following into another custom memory 
//and remove leading comments
// //One-second tick
// @0ms chn1 = fade from 0% to 100% for 120ms //incandescent On
// @500ms chn1 = fade from 100% to 0% for 120ms //incandescent Off
// @995ms //takes 1 tick to replay

//Time per bar of this bargraph controls how fast the countdown is
//make timePerBar exact 1-second multiples if using 1-second tick.
// max timePerBar is 50 seconds for 300s countdown (5 min)

define timePerBar 1s            //example 1s = quick demo, 10s = 1min timer

//chn1 through chn6 are the countdown. They fade one by one.
//chn7 is the explosion
//chn8 is optional brightness control of one-second tick
// connect chn8 to CC pin. CC Fx check box is only checked for the
// one-second tick. It turns off during explosion and recovery

//enable CC Fx if used
       chn8 = 100% //feed chn8 to CCfx pin with male-female extension

//initialize all channels on in sweeping fashion
        chn1 = fade from 100% to 0% for timePerBar //start dimming 1st bar
@+55ms chn2 = fade from 0% to 100% for 200ms //fade on bars quickly
@+55ms chn3 = fade from 0% to 100% for 200ms // "
@+55ms chn4 = fade from 0% to 100% for 200ms // "
@+55ms chn5 = fade from 0% to 100% for 200ms // "
@+55ms chn6 = fade from 0% to 100% for 200ms // "

//fade channels 1 by 1
@timePerBar chn2 = fade from 100% to 0% for timePerBar 
@+timePerBar chn3 = fade from 100% to 0% for timePerBar 
@+timePerBar chn4 = fade from 100% to 0% for timePerBar 
@+timePerBar chn5 = fade from 100% to 0% for timePerBar 
@+timePerBar chn6 = fade from 100% to 0% for timePerBar

@+timePerBar //wait for last bar to go dark

//Timer ended, disable CC Fx if used
             chn8 = 0%
//__________
// 6*timePerBar countdown total

//Explode
 chn7 = fade from 0% to 20% for 50ms 
@+50ms chn7 = 100%
@+20ms chn7 = 0%
@+20ms chn7 = 100%
@+20ms chn7 = 30%
@+25ms chn7 = 100%
@+20ms chn7 = 20%
@+25ms chn7 = 100%
@+25ms chn7 = 30%
@+30ms chn7 = 100%
@+25ms chn7 = 20%
@+30ms chn7 = 100%
@+30ms chn7 = 30%
@+40ms chn7 = 100%
@+35ms chn7 = 20%
@+40ms chn7 = fade from 100% to 0% for 1.8s 
//____
//440ms explosion total
// That leaves 995-440=555ms to end with

@+4.555s //end, replays at exactly xx.995s, same as 1second tick

The two extra functions are on Chn7 and Chn8:

  • Chn1 to Chn6     These are the digits counting down
  • Chn7                    The explosion
  • Chn8                   Turns on and off the one-second tick.

The explosion? Pretty clear. We wanted something to happen after the countdown. The next one is covered below.

How One Sequence can Turn Off Another

For the clock tick, we wanted it to stop blinking at the moment of explosion and start again on subsequent countdowns. To connect the countdown and blinker sequences together, the following theme is used:

 

The current Theme Designer does not support internal wiring. So we had to wire LED Port h to the CC pin externally. A male-female extension wire does the job. Then we had to check the box that tells the Morsel only to allow the CC pin to control LED i. It works just as expected.

This kind of control would allow any dimming percentage to control LED Port i, but we just wanted on and off, 0% and 100%. And now for our next trick.

A 60-Minute Countdown

The most elaborate sequences usually end in well under 30 seconds and may spend time in loops too, so it is no surprise that the Morsel’s maximum time stamp of 5 minutes and 27 seconds is almost never a limitation. But here is one case, perhaps a bit contrived, where we would like a straight 60-minute run before repeating.

We take advantage of one fact: Whenever a Go statement is taken, it sets the player’s time to the time stamp of the label it went to. Normally, these stamps are in order, but to extend the timeline, we carefully make the times out of order, starting all the way down at zero again. A sequence normally must end at 327 seconds. But by GOing past it, we get another whole 327 sec:

        //Caution Dead End!
        //Sequence can't go past 327s.
        //It will wrap-around and replay
        //we need to reset the timeline
@327s   go to newTimeLine   //we're just going to the next line 
  
@0s newTimeLine             //timeline resets here because Go statement does that
                            //newTimeLine must have an absolute time stamp, not relative
        //sequence can continue for another 5m 27s!

Of course, in our version, 5 minutes and 0 seconds was a nicer round number, so we never used the extra 27 seconds, except in the final explosion.

For a 60 minute sequence, we reset the timeline twelve times, two per fade. Fades use higher precision numbers, so we could load the fade durations directly:

        chn1 = fade from 100% to 0% for 600s  //no problem with 10 min or 10 hr fades

As listed, this example also counts down for 6 seconds. To change it to 60 minutes, use 600 seconds (10 min) and 300 seconds (5 min), respectively:

define timePerBar 1s       //max 600s 
define timePerHalfBar 0.5s //make 1/2 of line above, max 300s

The complete listing follows.

//6 LED Countdown 60-minute + 1 Explosion
//Looks like an odometer countdown or 6 bar bargraph shrinking
//this uses the trick of resetting the timeline to make the maximum time.
//60 minutes = 10 minutes per bargraph bar

//Works with a second custom sequence with a 1-second tick:
//Copy and paste the following into another custom memory 
//and remove leading comments
// //One-second tick
// @0ms chn1 = fade from 0% to 100% for 120ms //incandescent On
// @500ms chn1 = fade from 100% to 0% for 120ms //incandescent Off
// @995ms //takes 1 tick to replay

//Time per bar controls how fast the countdown is.
//Time per half bar is half that, used elsewhere
//make timePerBar exact 1-second multiples if using 1-second tick.
// max timePerBar is 600 seconds (10 min)

define timePerBar 1s           //max 600s
define timePerHalfBar 0.5s     //make 1/2 of line above, max 300s

//chn1 through chn6 are the countdown. They fade one by one.
//chn7 is the explosion
//chn8 is optional brightness control of one-second tick
// connect chn8 to CC pin. CC Fx check box is only checked for the
// one-second tick. It turns off during explosion and recovery

//enable CC Fx if used
       chn8 = 100%              //feed chn8 to CCfx pin with male-female extension

//initialize all channels on in sweeping fashion
       chn1 = fade from 100% to 0% for timePerBar //first fade starts @0ms
@+55ms chn2 = fade from 0% to 100% for 200ms
@+55ms chn3 = fade from 0% to 100% for 200ms
@+55ms chn4 = fade from 0% to 100% for 200ms
@+55ms chn5 = fade from 0% to 100% for 200ms
@+55ms chn6 = fade from 0% to 100% for 200ms

//fade channels 1 by 1


@timePerHalfBar Go To Bar1Half   //reset the timeline trick!

@0ms Bar1Half                    //new timeline starts here!

@timePerHalfBar Go To Bar1off    //reset the timeline again

@0ms Bar1off                     //Next bar starts fading now

               chn2 = fade from 100% to 0% for timePerBar

@timePerHalfBar Go To Bar2Half   //reset the timeline trick!

@0ms Bar2Half                    //new 300s or less timeline starts here!

@timePerHalfBar Go To Bar2off    //reset the timeline again

@0ms Bar2off                     //Next bar starts fading now
 
                chn3 = fade from 100% to 0% for timePerBar

@timePerHalfBar Go To Bar3Half   //reset the timeline trick!

@0ms Bar3Half                    //new 300s or less timeline starts here!

@timePerHalfBar Go To Bar3off    //reset the timeline again

@0ms Bar3off                     //Next bar starts fading now

                chn4 = fade from 100% to 0% for timePerBar

@timePerHalfBar Go To Bar4Half   //reset the timeline trick!

@0ms Bar4Half                    //new 300s or less timeline starts here!

@timePerHalfBar Go To Bar4off    //reset the timeline again

@0ms Bar4off                     //Next bar starts fading now

                chn5 = fade from 100% to 0% for timePerBar

@timePerHalfBar Go To Bar5Half   //reset the timeline trick!

@0ms Bar5Half                    //new 300s or less timeline starts here!

@timePerHalfBar Go To Bar5off    //reset the timeline again

@0ms Bar5off                     //Next bar starts fading now

                chn6 = fade from 100% to 0% for timePerBar

@timePerHalfBar Go To Bar6Half   //wait for last bar to fade half way

@0ms Bar6Half 

@timePerHalfBar Go To Bar6off    //wait for last bar to fade rest of the way

@0ms Bar6off                     //Done! Now the explosion.


//Timer ended, disable CC Fx if used
                 chn8 = 0%

//Explode
                 chn7 = fade from 0% to 20% for 50ms 
@+50ms           chn7 = 100%
@+20ms           chn7 = 0%
@+20ms           chn7 = 100%
@+20ms           chn7 = 30%
@+30ms           chn7 = 100%
@+20ms           chn7 = 20%
@+30ms           chn7 = 100%
@+30ms           chn7 = 30%
@+40ms           chn7 = 100%
@+30ms           chn7 = 20%
@+40ms           chn7 = fade from 100% to 0% for 2s 
//____
//330ms explosion total
//      That leaves 995-330=665ms to end with


@+4.665s //end, replays at exactly xx.995s, same as 1second tick

The four files are downloadable here. Extract and use:

60 second countdown and others.zip

 

Back
Back