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