I'm currently dealing with a new project and I have to send data through headphone jack with specific voltage, then i can work on that voltage.
so here i need to program the specific voltage depends on my data. is it possible that i can access the output voltage of headphones in android and then create a application to control that voltage?
Here is a HackADay article dealing with this issue. http://hackaday.com/2010/02/01/android-audio-serial-connection/ It offers working code which was quite a bit simpler than I thought it would be.
Although, like others have suggested, including this very similar SO post, you might have an easier time using the USB port.
the simplest way to catch input data from audio jack in android or iphone is through recording http://developer.android.com/reference/android/media/AudioRecord.html
think something similar like playing a linear pcm audio file , I have n't tried but I believe it should work
I believe you will have to dive deep into Assembly type language, however, why the headphone jack? As I understand it, only reverberations and sound are transmittable through the headphone jack. I believe it would be more feasiable to output voltage through the Mini-USB port.
I think this site may be of some help regarding my method:
you could maybe try turning your data into binary for example when your listening to music your head phone jack changes +- vibrating to make a sound so you could make +- = 0 and -+ = 1
来源:https://stackoverflow.com/questions/10248649/sending-data-through-headphone-jack-in-android-phones