My Week 7 Assignment technically fulfilled this assignment since it used a button, but I really wanted to learn how to take input from an accelerometer. So I thought I'd make a cube whose color changes depending on orientation. I imagined this as having six LED arrays (one for each face, to make sure light could be seen) I knew this could be achieved with tilt switches, but I had a three axis accelerometer from Week 7 so I decided to use that. I saw this assignment as overcoming three main knowledge barriers (i.e. I did not know how to do these things):
At first, as always, I thought "I can do anything!" but within a few hours I decided to focus first on the top two items. I'd build a board with one RGB LED whose color changed depending on the board's orientation. Unfortunately, I had a lot of trouble making the board. I struggled at first with the routing. It was my first time using an ATMega328 (which I needed because of the many pins required by an accelerometer and LED). I had trouble finding how the leads could go, much less getting it all to fit maintaining adequate spacing between leads and components. When I finally made the routing work, I had trouble soldering the ATMega. Rob (TA) recommended doing a solder layer, putting on the IC, and then cleaning up with a braid. But because I had leads underneath the IC, I was really wary of doing this. I had also started programming the accelerometer, but felt very uncertain of it, especially of calibrating the values and then translating that to a different intensity of light.
So... as with pretty much every week... I reduced the scale of the project. I decided instead to use three buttons to change the intensity of the LED. First I just made each button control one of the colors. I learned some more about C programming and how I might change the architecture of a program to fit what I wanted. I also had some trouble making the new makefile. In the end, I just had to change the device and use -F to force since it expected an ATMega328P (and fab lab only gave the non-P version).
After this I decided I wanted to make a dimmer switch. So... one button would make the LED brighter, one would make it dimmer. But a friend gave me an idea to make the colors slowly dim, make it a little trippy. This one took me longer to make because I had to first actually understand what Neil's LED Program was actually doing when it blended the colors. I made loops that slowly decrease pwm on the LED's, but reset when the button is pressed.
I think now that I understand dimming and brightening, I'll be ready to have something that dyanmically changes color. I can have the voltage from the accelerometer map to a PWM. I also have a board schematic that should work for that, I just need to route it and program it!