With the basic LED blink program under my belt I decided to step the light show up a notch. Part of the Getting Started with Arduino Kit is a small LED which, instead of only making one color, can combine red, green, and blue to make virtually any color. I made a small circuit that lets you cycle through all of the colors in the spectrum by pressing a left or right or button.
Writing the program was difficult numerically because the LED works by receiving three different signals, one for each color. The signal strength, in the code, is denoted by a number between 0 and 255. To get the light to 'cycle' I had to increase one light to max, increase the next to max, decrease the first, increase the next and so on.
The full code is 101 lines long. To see the code from the program go to the Projects page, scroll down to the appropriate project, and select the code. There you can also find the schematics for the wiring.
No comments:
Post a Comment