int trig = 4;
int echo = 5;
void setup() {
// put your setup code here, to run once:
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trig,1);
delay(10);
digitalWrite(trig,0);
////// Measure distance
long duration = pulseIn(echo,HIGH);
float dist = duration/58;
Serial.println(dist,2);
delay(1000);
}