|Project Illuminate Home|
One of the most interesting things to do with these lights is to make them behave in a pattern. In this section, you'll how to make the lights perform some basic patterns, and then you are free to create your own. Not only is creating your own pattern entertaining and challenging, but "Unique Patterns" is one of our competition levels, and so you can enter your pattern into the competition at the end of the week.
A basic pattern is to blink every other light. Using what you've learned about loops, if, and the modulus operator, add code to blink_alternating_lights() to blink every other light. Test it in the usual manner.
So far, you have learned how to blinks lights and change their color. Another neat feature of these lights is their ability to fade. To fade a light from off to on (or vice versa), you slowly adjust the brightness. Take a look at the given function fade_brightness(). This function almost works, but the body of the loop is missing. Correct this code so that the lights fade from off to on. Test in the usual manner.
Now that you can fade the lights, try:
One of the most recognizable patterns is that of chasing lights. In this pattern, lights light up one after another in order so that it appears the light is moving down the strand. You can see a sample of this in this youtube video. That chase is using two different colors and two different sets of lights, but you can see the concept in action.
For this task, implement a chase pattern inside the provided function chase().
Above you completed the chase pattern in the typical way, but this framework actually has special support for patterns such as chase. The strand data structure has not only an element for each light but also has an element for an extra light at the end of the string (spot 16). Additionally, it provides a function, strand_scroll() that will automatically scroll the pattern for you---by shifting the characteristics of bulb x to bulb x-1.
To use these features, set your desired characteristics to the fictional bulb strand[STRAND_LENGTH] and then call strand_scroll(). You'll see that characteristic propagate down the lights.
Once you have played with strand_scroll() some, implement a chase with alternating colors in the given stub function chase_two_colors_with_scroll(). This task is harder than the ones you have had previously, so be certain to carefully consider what you need to do before you begin coding.
Congratulations! You have completed all the given tasks related to controlling the lights and reached Competition Category One. Now you should create a pattern of your own design. Some basic patterns that you could implement and then extend are showcased at this website, though they are not implemented in the GE-35 lights.
To implement your pattern, you may add new files to the sketch or add new functions to the test.cpp/h files. Whichever you choose, be certain to call the appropriate functions from the loop() function in pattern_framework.
After creating a pattern of your own design, you may choose to move on to either dancing lights or displaying a message, which are also competition categories, or you may compete in the pattern category. Whichever you choose, be sure to follow the competition rules!
Towards the end of the week, you'll want to eliminate some of the startup test patterns performed by the software. When you're ready, ask us and we'll show you how!