The prior version stored the static table in RAM, which is wasteful of a hundred or so bytes of RAM. Indeed, it appears that it works just fine.Īdditionally, I made a few other small changes to my program. I also hooked up my oscilloscope so I could verify that the tone was coming out at the proper frequency. Anyway, I hooked the positive lead of the element up to pin 9, and the negative lead to ground. It is nominally targeted toward mbed microcontrollers, but nothing about it is specific to those. It’s probably a good idea to use a little drive transistor with an 8 ohm speaker to provide more drive: you can see the basic idea here. You can substitute a speaker if you like. These disks are terrible at reproducing low frequencies and have strong resonances, but for this purpose, it was convenient. Rather than using a speaker, I wired up a little piezo element which I had soldered a couple of leads onto my junk pile. I mentioned that I had done this before, but frankly couldn’t find the source code, so I modified my existing program to implement the simplest possible tone: a simple square wave. Commenter Andy wanted a version of my classic code that could generate a tone instead of just blinking an LED.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |