First Bytes 2014
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:
- As in your pattern framework, the bulbs are addressed from 0 to
15. Bulb 0 is currently programmed as a conductor to indicate when
the dancing is about to begin so the music should start. You are, of
course, welcome to change this.
- 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 with music 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 use it in the lab.
(It has already been installed for your use on the lab machines.)
- 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