int trigPin=13;
int echoPin=11;
float pingTime;
float speedOfSound=343;
float targetDistance; 

#include <LiquidCrystal.h>              
LiquidCrystal LCD(10, 9, 5, 4, 3, 2);  

void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  LCD.begin(20,4); 
}

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

  pingTime = pulseIn(echoPin, HIGH);
  targetDistance = speedOfSound * pingTime/1000000;
  targetDistance = targetDistance/2*100;
  Serial.print("De afstand is: ");
  Serial.print(targetDistance,1);
  Serial.println(" centimeter");
  LCD.setCursor(0,0);
  LCD.print("De afstand is:");
  LCD.setCursor(0,1);
  LCD.print("                    ");
  LCD.setCursor(0,1);
  LCD.print(targetDistance,1);
  LCD.print(" centimeter");
  delay(1000);
}