In your smartcar.ino sketch you are using pulseIn directly which can be avoided if you just use an SR04 sensor and its getDistance() or getMedianDistance() method.
digitalWrite(trigPinSide, LOW);
delayMicroseconds(2); //delays are required for a successful sensor operation
digitalWrite(trigPinSide, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPinSide, LOW);
duration = pulseIn(echoPinSide, HIGH);
sideDistance = (duration / 2) / 29.1; //convert the distance to centimeters
In your smartcar.ino sketch you are using
pulseIn
directly which can be avoided if you just use anSR04
sensor and itsgetDistance()
orgetMedianDistance()
method.