I built a Distance Noise Machine using an Ultrasonic Ranger, a Multichannel Bipolar Transistor Driver, and a Speaker. The Ultrasonic Ranger sends pings and waits for the echo, then calculates the distance of the object from this result. The Speaker then plays tones at a speed corresponding to the distance of the object. The closer the object, the faster the tone, the farther away the object, the slower the tone.

I had some issues with using the Arduino Tone Library, as it turns out the Ping code and the Speaker code both used Tone. This causes conflicts, so with some research, I learned I needed to use New Tone with one of the sensors, so they wouldn’t conflict.

I’m currently experiencing a lag with the tone speed at times which I think is due to my code and the way the DELAY is written. The code is posted here. 

The links for the libraries, exercises, and tone conflict information are listed below:

Multichannel Bipolar Transistor Driver

https://courses.ideate.cmu.edu/16-223/f2017/text/ex/Arduino/multichannel-driver/multichannel-driver.html#exercise-multichannel-driver

 

Ultrasonic Ranger:

https://courses.ideate.cmu.edu/99-355/f2017/text/recipe/ultrasonicRanger.html

 

Arduino Tone Reference :

https://www.arduino.cc/en/Reference/Tone

https://code.google.com/archive/p/rogue-code/wikis/ToneLibraryDocumentation.wiki

https://github.com/bhagman/Tone/blob/master/README.md

 

Conflicts with the Tone Library :

https://bitbucket.org/teckel12/arduino-new-ping/wiki/Multiple%20Definition%20of%20%22__vector_7%22%20Error

 

What fixed it:

Arduino New Tone :

https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home