const int TRIG = 27;
const int ECHO = 14;
float distance;
long duration;
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(10);
digitalWrite(TRIG,HIGH);
duration = pulseIn(ECHO,HIGH);
distance = 0.017*duration;
Serial.println("distance : "+String(distance));
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}