Using ultrasonic sensor to detect wall when robot is driving

I doubt changing to millis() in the echo function will fix it.

delayMicroseconds() isn't that bad, that's just a couple of ticks. delay(1) is delayMicroseconds(1000) aka 3 orders a long :wink:

But if you want real help, post all code in a compilable way. Don't let us copy and past back the code into the whole program.