Please put short programs in your Post so we don't have to download them. Like this
g#include <LiquidCrystal.h>
#include <Servo.h>
#include <NewPing.h>
#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
Servo myservo;
int pos = 0;
int it = 10;
int lld;
LiquidCrystal lcd(6,5,7,4,3,2);
void setup() {
lcd.begin(16, 2);
myservo.attach(9);
Serial.begin(9600);
delay(3000);
}
void loop() {
int i = 0;
int t = 0;
float a = 0;
for (i = 0; i < 180; i ++)
{
unsigned int uS = sonar.ping();
myservo.write(i);
delay(20);
for (t = 0; t < it; t++)
{
uS = sonar.ping();
a = uS/US_ROUNDTRIP_CM + a;
delay(30);
}
a = a / (it-1);
t = 0;
Serial.println(a);
a = 0;
lcd.print(uS/US_ROUNDTRIP_CM);
delay(500);
lcd.clear();
}
}
...R