I am going show you how to read the Ultrasonic Distance Sensor and use the measured distance to guide a robot. In this tutorial, the robot moves backward and turns away if it senses something that is too close.
Please follow my other instructable to connect the motors. In addition, you will need to attach the ultrasonic distance sensor (HC-SR04) to the Fabric Shield. There are female header pins specifically designed to connect to this sensor. See picture attached.
Basically, the "Trig" and "Echo" pins connect to A1 and A0 pins of Arduino Nano respectively.