This week we focused on outputs and I wanted to do something with a speaker building towards my final project (which now seems extremely ambitious... hm...)
I made the speaker board and programmed it (here's the code) to play a hacky version of Axel F from Beverly Hills Cop.
Images
In my first attempt at milling and stuffing the board, I soldered the Attiny45 on upside-down. Doh! I tried unsoldering at home with two broken soldering irons but that just really didn't work.
Nadya gave me a great tutorial for how to get my computer up and running with AVR (I've previously been using Arduino). And I had tried using Arduino's tone generation library but the sounds were all wrong which I think has to do with the 8Mhz clock on the Attiny45 vs the Arduino but I didn't understand how or if I could modify that in Arduino.
I wanted to modify the sounds coming from the speaker to do something other than random, annoying noises. I was able to get it to play a hacky version of Axel F, but I must admit that I don't really understand what's going on behind the scenes in the code and the electronics so I wasn't able to get it more precise (i.e. how to control the Hz precisely to generate the right tones). I do understand that the speaker program is turning current off and on in order to make the magnet in the speaker vibrate at a certain frequency but I wasn't sure how to control that frequency from the program.