How should i control these motors?

I have two motors that can run on 12v or 9v and im using the arduino motor shield with a 9v battery plugged into the arduino itself and another one plugged into the vin and ground next to where the motors are plugged in. Ive tried using one library but i dont remember what it was but i wasnt able to stop or reverse the motors. (there is also a PING sensor plugged in as well) What library/example code should i use?