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