NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

murphy:
I have a project with 8 HC-SR04.

My problem is that when I trigger a sensor, the sensor closest are also triggered. I'm not yet used this new library. Can anyone give me an idea how can I do that with this new library?

The project summary is:
8 sensors HC-SR04 each sensor being fired one at a time.

The distance that the sensor is triggered should be between 5 and 15 cm.

I have an example sketch that pings 15 sensors that's designed to be scaled to any number of sensors.

http://code.google.com/p/arduino-new-ping/wiki/15_Sensors_Example

Just set SONAR_NUM to 8 and modify the sonar object array to 8 sensors and to the pins tied to each. This sketch works using the timer method so there's no delays and it will therefore work in many complicated sketches (just do everything triggered from events with no delays). Also, as NewPing will work using the same pin for both trigger and echo, you only need to use 8 pins to work with all 8 sensors. So, it's possible that your project would fit on a Uno or Teensy 2.0. Which is a huge bonus for both price and size.

You shouldn't have any problem getting this example sketch working with your 8 sensors. And it shouldn't be much of a challenge getting it integrated with your overall project sketch.

I'm going to make another post with tips on using the 15 sensor example sketch as some are having problems understanding how to use an event-driven sketch like this.

Tim