Search code examples
swiftarduinoavaudioplayeravaudiorecorder

Sending data through the iphone headphone jack


I am working on an iPhone in Swift that will detect the button press from the arduino through the headphone jack.

I'll have a button installed on the arduino that will change the pins and the frequency.

I wasn't sure what framework should i use in the iOS - Should i use

  • AVCaptureAudioDataOutput
  • AVAudioRecorder

or something else?

Its just detecting the button press.

Thanks


Solution

  • Used

      let averagePower = audioRecorder.averagePowerForChannel(0)
    

    for getting the power.

    On the hardware side used arduino UNO and generating the tone.