//Coded By: Nitin Rajput
const int tp=8;
const int ep=7;
long dur;
int disCM;
void setup()
{
pinMode(tp, OUTPUT);
pinMode(ep, INPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(tp, LOW);
delayMicroseconds(5);
digitalWrite(tp, HIGH);
delayMicroseconds(10);
digitalWrite(tp, LOW);
dur=pulseIn(ep,HIGH);
disCM=dur*0.034/2;
Serial.print("Distance in CM: ");
Serial.println(disCM);
}