const int trig=2;
const int echo=4;
long duration;
int distance;
void setup()
{
Serial.begin(115200);
pinMode(trig , OUTPUT);
pinMode(echo, OUTPUT);
}
void loop()
{
digitalWrite(trig,LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo,HIGH);
distance = (duration*0.034/2)+1;
Serial.println("distance" + String(distance));
}