int trig = 14 ;
int echo = 27;
int reading ;
int distance ;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}
void loop() {
digitalWrite(trig, HIGH);
delay(100);
digitalWrite(trig, LOW);
Serial.println("singnal out ");
reading = (pulseIn(echo,HIGH));
distance = (reading*0.034/2);
Serial.println(distance);
Serial.println(" singnal in");
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}