int Trig_pin=5;
int Echo_pin=18;
long duration;
float speed_of_sound=0.034;
float dist_in_cm;
void setup() {
Serial.begin(115200);
pinMode(Trig_pin, OUTPUT);
pinmode(Echo_pin,INPUT);
}
void loop() {
digitalWrite(Tirg_pin,LOW);
digitalWrite(2);
digitalWrite(Trig_pin,HIGH);
digitalWrite(10);
digitalWrite(Trig_pin,LOW);
duration =pulsein(Echo_pin,HIGH);
dist_in_cm=duration*speed_of_sound/2;
Serial.print("The distance is ::");
Serial.println(dist_in_cm);
delay(10);
}