NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

teckel:
Quite simple, the distance is wrong because you're not using the correct speed of sound for your temperature. Also, you're not even using the NewPing library so your entire question is out of scope. Use the NewPing library in your sketch and use the built-in speed of sound calculations and then if it's wrong I can give guidance.

Tim

Thank you Very much Sir Tim.

Here is my code.

#include <NewPing.h>
#include <LiquidCrystal.h>

unsigned long previousMillis = 0;        
const long interval = 500;           

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ledLCD = 6;

#define TRIGGER_PIN  9 
#define ECHO_PIN     10  

NewPing sonar(TRIGGER_PIN, ECHO_PIN); 

void setup() {
  lcd.begin(16,2);
  pinMode(ledLCD,OUTPUT);
   
}

void loop() {
   unsigned long currentMillis = millis();
  digitalWrite(ledLCD,HIGH);
  
  delay(35);                      
  unsigned int uS = sonar.ping(); 
 if (uS != NO_ECHO) {
  
    if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;

    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Ping: ");
    lcd.print(uS / US_ROUNDTRIP_CM); 
    lcd.print(" cm ");
   }
 }
}