int trig = 27;
int echo = 14;
int distance;
int duriation;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}
void loop() {
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duriation = pulseIn(echo,HIGH);
distance = (duriation * 0.034)/2 + 1;
Serial.println(duriation);
delay(200);
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}