int trigPin = D7; int echoPin = D8; int pingTravelTime; void setup(){ pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); Serial.begin(9600); } void loop() { digitalWrite(trigPin, HIGH); delayMicroseconds(10); pingTravelTime=pulseIn(echoPin, HIGH); delay(25); digitalWrite(trigPin, LOW); Serial.println(pingTravelTime); }