ping transmitter and receiver

hi everyone.
in my project I need to build a ping ultrasonic transmitter and use another ping sensor to receive that signal,to test that method I removed the emitter from one of the pings and the receive from the other one,and I modified the arduino ping example sketch to test it,so one of pings will send the signal and the other one receive it . but that didn't work ,what kind of method should I use
here is the code

const int pingPin1 = 7;
const int pingPin2 = 8;

void setup() {

  Serial.begin(9600);
}

void loop()
{
  
  long duration, inches, cm;

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin1, LOW);

   
  

  
  pinMode(pingPin2, INPUT);
  duration = pulseIn(pingPin2, HIGH);
  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

but that didn't work

But what did it do?

My guess is the receiver didn't listen, because it didn't get a trigger pulse to transmit.

Please use code tags when posting code.

AWOL:

but that didn't work

But what did it do?

My guess is the receiver didn't listen, because it didn't get a trigger pulse to transmit.

yes ,by using the serial monitor it shows that it didn't read the ultrasonic signal(it shows 0cm,0inch),and I am using the same arduino uno for both pings

I am sorry but I don't know how to use the code tags

it shows that it didn't read the ultrasonic signal

So, trigger the receiver when you trigger the transmitter.

I am sorry but I don't know how to use the code tags

It is explained here, at the top of this section, in bold

AWOL:

it shows that it didn't read the ultrasonic signal

So, trigger the receiver when you trigger the transmitter.

sorry to bother you again sir but I am still a beginner in using the arduino and sensors in general,so how can I trigger them both at the same time

You're triggering one now, so all you need to do is insert the same sequence of pinMode and digitalWrite for the second sensor pin.

You can go back and edit previous posts by clicking on "Modify", then add the code tags, then click on "save".