DIY ultrasonic sensors

Hello, I have built an DIY 40khz ultrasonic sensors to be part of a collision avoidance system for an remote control car but am having some trouble with the programming of it
The ultrasonic transmitter consists of a H-bridge circuit and the receiver consists a amplification circuit and a signal detection circuit.
I have used one of those kit ultrasonic range finders before (HCSR04) and have had no problem using that
Such as:

int sense() { //  the main code goes here, to run repeatedly
  long duration, distance; //duration used to calculate distance
  digitalWrite(trigPin, LOW);  // 
  delayMicroseconds(2); // 
  digitalWrite(trigPin, HIGH); // this sends out a short pulse for 10ms
  delayMicroseconds(10); // 
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH); // when an echo is received the echoPin goes HIGH
  distance = (duration/2) * 0.0341 ; // The speed of sound 0.0341 cm/micro second
  return distance;
}

Is it not possible to use the same code, or do i have to go a little deeper into the matrix?

delayMicroseconds(2);

This won't work that quick. Check the Reference page, I think 4 is the lowest.
Also look into Direct Port Manipulation instead of digitalWrite, that will help speed things up a lot.
For example, say trigPin was on D2, or PORTD Bit 2:
PORTD = PORTD & 0b11111011; // clear bit 2
PORTD = PORTD | 0b00000100; // set bit 2

Also:
digitalWrite(trigPin, HIGH); // this sends out a short pulse for 10ms
delayMicroseconds(10); //

that is 10uS, not 10mS - which did you really want?