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;
}
}
}