Smartphone / cellphone headset clicker V2
Many modern cellphones can be crudely controlled through their headset stereo jack by simulating headset button clicks.
Update: I think I misread the lines; GND and microphone are switched. Therefore text in bracketed italics below is incorrect. The given circuit will still work and should not damage anything, but a much simpler approach will be to simply ground the corrected phone GND line (i.e. on my Droid Incredible ring2) to the microcontroller GND and then the bias on the microphone line is +2.5V and the microcontroller can use normal output pin settings. If you don't want to ground the phone and microcontroller together, you could use an optocoupler (aka solid state relay) like Omron G3VM-61A1 to switch the microphone-to-ground connection. Because the LED in this optocoupler is very low voltage/current, you need a pretty high series resistor if your microcontroller outputs are running at 5V; I found 4.7kOhm worked.
Improved version. See original for more details.
We can eliminate the Zener diode from the original design by setting the IC pin to high-resistance (i.e. setting it to "input" mode) when we want the NPN gated off. We can drive the NPN gate open without changing the IC pin mode by simply connecting the internal pull-up resistor. R1 is included simply to protect the phone; this is probably not necessary, but everything functions with R1 10 Ohm, which better matches what my test headset does.
Code is included. Arduino functions are not named very well for using the pin in this manner, so I renamed them.
(I tried eliminating the transistor too, by connecting the Arduino pin directly to the microphone line and then switching it between open and grounded, but that didn't seem to work. May not be a good idea to have the microcontroller in input mode and receiving negative bias; not sure.)