const int trigPin = 5;
const int echoPin = 18;

#define SOUND_SPEED 0.034
#define CM_TO_INCH 0.393701

long duration;
float distanceCm;
float distanceinch;

void setup(){
  Serial.begin(115200);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop(){
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);


duration = pulseIn(echoPin, HIGH);
distanceCm = duration*SOUND_SPEED/2;
distanceinch = distanceCm*CM_TO_INCH;

Serial.print("Distance (cm):");
Serial.println(distanceCm);
Serial.print("Distance (inch): ");
Serial.println(distanceinch);

delay(1000);
}