/*write a program to interface the ultrasonic sensor wit esp32 to display the distance on
serial monitor.*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
const int trigPin =15;
const int echoPin =19;
void setup(){
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
lcd.init();
}
void loop(){
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
delayMicroseconds(10);
float t = pulseIn(echoPin, HIGH);
float d = (t*0.034)/8;
lcd.setCursor(0,0);
lcd.print("distance: ");
lcd.print(t);
delay(1000);
}