I have no clue because you did not post code. However if you want to get the Ping sensor to work there is an example code that comes along with the IDE for that.
In the Arduino IDE menu click File -> Examples -> 06.Sensors -> Ping.
This code assumes your Ping sensor is hooked up to digital pin 7. If it isn't then scroll to the line that says: const int pingPin = 7;
Change the 7 to be the digital pin you connect the Ping sensor to.
As for the code for the Arduino Motor controller look at this tutorial:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/?ALLSTEPS