#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
#define trig 7
#define echo 6
void setup() {
// put your setup code here, to run once:
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
int duration = pulseIn(echo,HIGH);
int distance = duration * 0.034/2;
lcd.init();
lcd.backlight();
lcd.setCursor(0,2);
lcd.print("Distance :");
lcd.setCursor(12,2);
lcd.print(distance);
}