what i must change to add ping to my robot

this is my the code of arduino i want to add ping sensor code can you help me

#include <Servo.h> 
Servo direct ;  // create servo object to control a servo 
Servo mouvement ;  // create servo object to control a CC motor
int spd = 100 ;  // variable to store the CC motor speed
int ang = 96 ; // variable to store the servo position
Void setup ( )  // run once, when the sketch starts
{
Serial.begin (9600) ;  // set up Serial library at 9600 bps
direct. attach (9);   // attaches the servo on pin 9 to the direct object
mouvement.  attach  (10,  400,  2600);    //  attaches  the  CC  Motor  on  pin  10  to  the 
mouvement object t
mouvement.write (spd) ;
direct.write (ang) ;
}
void loop ( )  // run over and over again
{
// if(Serial.available ( ) )
{
int c =  Serial.read ( );
switch (c)
{
case  ' 0 ':  if (spd < 180)
spd++;
mouvement.write (spd);
break;
case ' 1 ': if (spd > 0)
spd --;
mouvement.write (spd);
break;
case ' 2 ': if ( ang < 115 )
ang ++;
direct.write (ang);
break;
case ' 3 ': if (ang > 72)
ang--;
direct.write (ang);
break;
}
}
}

There is a library called NewPing that might help.

What do you want to do with the distance information?

i want to add 2 ping code i don't know how

i want to add ping code in this code
to make robot stop when detect object