Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
We are not here to write code for you, you must show some attempt at writing the code you require.
First write code to read and operate your ultra-sonic sensor, then your motor driver then put them together.
I recommend you do not try and write ALL the code at once.
Can you please tell us your electronics, programming, Arduino, hardware experience?
Thanks.. Tom.. ![]()