- I copied stuff from an older debug version. Clearly the "state" variables made no sense. Sorry about that.
- The code was suboptimal. Literally…
The original version of the code used a lot of int types. But since the highest value I was ever using was 255, I was easily able to convert all my ints to bytes. I also was able to greatly optimize my throb() method. Instead of doing two for() loops, I was able to replace it with a single do/while and just call into solid() with the correct parameters. Here’s the end result:
With all of these changes, I was able to reduce the compiled sketch size from 4024 bytes down to 3548 bytes. A savings of 476 bytes (12%)! Is there anything else that can be shaved off?
I finally created a new project on CodePlex for this and called it Yaam – Yet Another Ambient Munny. The code will be up there once I get SubVersion installed.
[Update 2009-04-11 11:10PM: Yaam is now live on CodePlex! Go to http://yaam.codeplex.com to view the Arduino source.]