interfacing of multiple ultrasonic sensors at same time

i am working on a project using three ultrasonic sensors(HC-SR04) .But the problem is i cant get the value of multiple ultrasonic sensors at same time.Only one sensor is reading output i want to check the value of two, three sensors at same time. Here the program shown below .i hope someone will help me with it .
thank you…!!

/* ForNext Labs
BLIND CANE SENSOR*/

#include <Ultrasonic.h>

#define trig1 8
#define echo1 9
#define trig2 10
#define echo2 11
#define trig3 12
#define echo3 13

#define playR 1
#define playF 2
#define playL 3
#define playRF 4
#define playRL 5
#define playFL 6
#define playRFL 7

Ultrasonic ultrasonic1(trig1, echo1);
Ultrasonic ultrasonic2(trig2, echo2);
Ultrasonic ultrasonic3(trig3, echo3);

void setup()
{

Serial.begin(9600); // begin serial communitication
Serial.println(“Initialising…!!”);
pinMode(trig1, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echo1, INPUT);// set the echo pin to input (recieve sound waves)
pinMode(trig2, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echo2, INPUT);// set the echo pin to input (recieve sound waves)
pinMode(trig3, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echo3, INPUT);// set the echo pin to input (recieve sound waves)

}

void loop()
{
long duration1, distance1; // start the scan
digitalWrite(trig1, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trig1, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trig1, LOW);
duration1 = pulseIn(echo1, HIGH);
distance1 = (duration1/2) / 29.1;// convert the distance to centimeters.

long duration2, distance2; // start the scan
digitalWrite(trig2, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trig2, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trig2, LOW);
duration2 = pulseIn(echo2, HIGH);
distance2 = (duration2/2) / 29.1; // convert the distance to centimeters.

long duration3, distance3; // start the scan
digitalWrite(trig3, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trig3, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trig3, LOW);
duration3 = pulseIn(echo3, HIGH);
distance3 = (duration3/2) / 29.1; // convert the distance to centimeters.

//CONDITION FOR GUIDANCE

if (distance1 < 30)/*if there’s an obstacle in right do the following: */
{
Serial.println(“RIGHT”);
Serial.print (“Distance From RIGHT is " );
Serial.print ( distance1);
Serial.print ( " CM!”);// print out the distance in centimeters.

digitalWrite(playR,HIGH);

delay(400);
}

else if (distance2 < 30)/*if there’s an obstacle in front do the following: */
{
Serial.println(“FRONT”);
Serial.print (“Distance From FRONT is " );
Serial.print ( distance2);
Serial.print ( " CM!”); // print out the distance in centimeters.

digitalWrite(playF,HIGH);

delay(400);
}

else if (distance3 < 30)/*if there’s an obstacle in left do the following: */
{
Serial.println(“LEFT”);
Serial.print (“Distance From LEFT is " );
Serial.print ( distance3);
Serial.print ( " CM!”);// print out the distance in centimeters.

digitalWrite(playL,HIGH);

delay(400);
}

else if (distance1 < 30 && distance2 < 30)/*if there’s an obstacle in right&front do the following: */
{
Serial.println(“RIGHT & FRONT”);
Serial.print (“Distance From RIGHT&FRONT is " );
Serial.print ( distance2);
Serial.print ( distance1);
Serial.print ( " CM!”);// print out the distance in centimeters.

digitalWrite(playRF,HIGH);

delay(400);
}

else if (distance1 < 30 && distance3 < 30)/*if there’s an obstacle in right&LEFT do the following: */
{
Serial.println(“RIGHT & LEFT”);
Serial.print (“Distance From RIGHT&LEFT is " );
Serial.print ( distance1);
Serial.print ( distance3);
Serial.print ( " CM!”);// print out the distance in centimeters.

digitalWrite(playRL,HIGH);

delay(400);
}

else if (distance2 < 30 && distance3 < 30)/*if there’s an obstacle in left&front do the following: */
{
Serial.println(“LEFT & FRONT”);
Serial.print (“Distance From LEFT&FRONT is " );
Serial.print ( distance2);
Serial.print ( distance3);
Serial.print ( " CM!”);// print out the distance in centimeters.

digitalWrite(playFL,HIGH);

delay(400);
}

else if (distance1 < 30 && distance2 < 30 && distance3 < 30)/*if there’s an obstacle in right&left&front do the following: */
{
Serial.println(“RIGHT & LEFT &Back”);
Serial.print (“Distance From RIGHT&LEFT is " );
Serial.print ( distance1);
Serial.print ( distance2);
Serial.print ( distance3);
Serial.print ( " CM!”); // print out the distance in centimeters.

digitalWrite(playRFL,HIGH);

delay(400);
}

else
{
Serial.println(“walk”);
}
}

Do not double post.

The NewPing library includes an example of using 15 ultrasonic sensors. Perhaps that will provide a good basis for using three sensors.

hemanthmp07: i am working on a project using three ultrasonic sensors(HC-SR04) .But the problem is i cant get the value of multiple ultrasonic sensors at same time.Only one sensor is reading output i want to check the value of two, three sensors at same time. Here the program shown below .i hope someone will help me with it . thank you...!!

For what you want to do, the code you posted contains an an amazing amout of blocking "full bullshit function calls" like "delay()" and "pulseIn().

If you are planning to read your sensors "at the same time", or let's better talk about "nearly the same time", you will have to use different programming techniques than "blocking program execution with "busy waiting" for each sensor to read.

You will have to use "overlapping sensor triggering and echo duration reading" instead.

I'd like to suggest: - trigger all three sensors at the same time (this can be done by connecting the same Arduino output pin to the three different trigger pins on three different ultrasonic sensors. - then read the responses from the sensors echo pins as they are coming in one after another (or not at all when out of measuring range).

You probably shouldn't trigger multiple ultrasonic sensors "at the same time" because the sensor can't distinguish it's own echo from the echo of the other sensors. That can cause false readings. The NewPing15Sensors example spaces them out at 33 millisecond intervals and the comments note that 29 milliseconds is about the minimum spacing needed to avoid cross-talk. Three sensors as 33 millisecond intervals would be about 100 milliseconds or ten sets per second.

Thank you for your valuable support...!