First Bytes 2013
Now that you have created a pattern for your lights, you can also
program the lights to dance and, if you choose, compete in the dancing
lights categories rather than in the pattern or message categories.
To do this task, you would need to choose a piece of music and the
time the lights to dance with that music. (Be sure to follow
the rules of the competition!)
As an example, these lights are dancing to
To help you, we have provided a music framework
(called music_framework and available on your USB drive).
This music framework has essentially the same files and setup as your
pattern framework, but it does differ in some important ways:
- In your pattern framework, the bulbs are addressed from 0 to 15.
In the music framework, the first bulb is still bulb 0, but ALL the
other bulbs are bulb 15. This addressing allows all but one of the
bulbs to be synchronized. The "extra" bulb (bulb 0) can be used as a
conductor to indicate when the dancing is about to begin so the music
should start. You'll notice the difference on startup when the test
patterns are very different.
- To that end, files music.cpp/h include
functions dance() and conductor_start(). You can
code your dance here (and add any functions you wish) and be certain
to call the appropriate functions from the loop() function
- For your project to run on an infinite loop, you'll most likely
need to edit whatever music file you choose. A good editing software
is Audacity; here is a tutorial for how to install and use it in the lab.
(You'll have to install it each time you
login and want to use it.)
- One final note: you'll need to reset the addressing of the lights,
and the lights are only addressed at start up. So, unplug your
lights, upload your dancing program, and then plug in the lights while
holding down the reset button. Voila! Your lights have the correct