Multiple sensors with median

Issue #19 resolved
Magnus created an issue

I posted this as a reply to a closed thread few days ago, I tought that you might not get notification and notice it so I'll create a new thread on the matter.

Quote from other thread.

"Hello, I want to thank you for the committment and sharing of your library.

Im trying to solve the same issue, using median value on multiple sensors instead of a single one. I'd appreciate the help to combine the 15 sensor sketch with median method as you proposed to Oliver. I've tried both examples independetly but I'm not good at programming, especially not C++ to make it work.

What I intend to use the ultrasonic sensors for are a music instrument connected to raspberry pi 3, I have accomplished to send and receive MIDI to the raspberry with another sketch using the MIDI library to send midi inputs from a single ultrasonic, but I'd like to use it with NewPing, So I'd be using both NewPing with MIDI library for my sketch.

My current project contains of using 2 sensors, for a theremin-like instrument (one sensor for volume/velocty and one for pitch), but I'll improve and add more sensors after Ive accomplished the theremin project, to create a piano-like layout instrument."

Comments (5)

  1. Tim Eckel repo owner

    This is not an issue with the library, it's a request to help you program or learn to program. Creating an issue is not how you go about asking for assistance with programming unrelated to the usability of the library. For help with programming, post on the Arduino forums with your question. There's a forum thread for the NewPing library here or you can create your own new thread if you wish.

  2. Magnus reporter

    Ah okay, I see. I didn't know it was strictly issues with the library; as other issues posted here, like the one I related to in my post was an assistance to use the library with example, and with your proposal to guide with an example I tought it was appropriate to create a new issue for the same kind of matter.

    Thank you anyway for your time and answer.

  3. Tim Eckel repo owner

    You're not even using an Arduino. The library is Arduino only, see the name "Arduino New Ping" and supported hardware section of the FAQs. You're questions are all over the place and obviously well over your head. If you're using a Raspberry Pi, you shouldn't even be using NewPing as it uses specific AVR timers and the 15 sensor sketch would be IMPOSSIBLE to work on a Raspberry Pi without a total rewrite. Basically, you're trying to run before you walk and with totally different hardware while expecting people to write your code for you. My suggestion would be to either learn it yourself or hire someone to write the code for you. No one is going to write this for you for nothing as it would require more than 5 minutes effort. BTW, this "Issue" is closed, please don't use this as a forum or chat.

  4. Magnus reporter

    I use it with arduino, the arduino is communicating with the raspberry pi with MIDI-serial.

  5. Tim Eckel repo owner

    You never mention you're using Arduino hardware, only Raspberry Pi. A clear description can go a long way.

    Why not just do ping_median() twice, once for each sensor? The 15 sensor example is a EXTREME example for a programming paradigm that's probably best left for the experts. I'm guessing you're going to adopt a more blocking mode programming style.

    Anyway, simply ping the two sensors with ping_median(). See the ping 3 sensors sketch example, which uses blocking mode programming and probably makes more sense. Just change it to ping only 2 sensors and change the ping_cm() to ping_median().

    In any case, this isn't a library issue so this isn't the place for questions. The NewPing support forum previously linked is the correct place, please use that like everyone else, you're becoming a nuisance.

  6. Log in to comment