0

I am working on a line-following robot that works with computer vision. The image processing is done on an iPhone using OpenCV. For controlling the robot I have two ideas:

  1. Generate sound of given frequencies (e.g. the higher the frequency, the more the robot should move to the left; the lower the frequency, the more the robot should move to the right). I have already done this successfully on an Android device. I found this code: Produce sounds of different frequencies in Swift, however I do not understand how I can play a sound indefinitely until a new frequency is given. Is this possible with this code, if yes, how?
  2. If it would be possible (which I don't know) to precisely control the output waves of the sound in stereo (one channel for the left motor, one channel for the right motor), I could in theory directly control the motor driver from those 'sound' waves. Would this be possible or is this too complicated?

Note that I would like to avoid to use wireless communication such as a bluetooth or wifi module, since the environment in which the robot will be used will be used will have lots of possible interference.

Thank you in advance!

Anton
  • 137
  • 2
  • 14

1 Answers1

0

What about infrared communication? Makes more sense than sound.

Nino
  • 702
  • 2
  • 6
  • 12
  • Could you be more specific? Because I don't think iPhones can emit infrared light, or am I wrong about that? – Anton Nov 14 '20 at 16:07
  • The idea is to build a simple two way sound to IR converter and plug it in the earphones jack. This way you are not counting on sound which would be problematic unless you are in the lab. – Nino Nov 14 '20 at 16:16
  • I see what you mean but I can make the Arduino read the frequency directly from the headphone jack, so I don't see the problem there (unless you mean something else?). Have you any idea how to generate the sound in iOS, or some good links/tutorials/documentation on how to do so? – Anton Nov 14 '20 at 16:19
  • Ok, so you are wired, that's fine of course. As for generating the sound on the iphone, sorry, app programming is not my strong side. – Nino Nov 14 '20 at 16:31
  • Thanks for your help anyways, as you may have guessed, app development is not my strong side either... – Anton Nov 14 '20 at 16:32