Obstacle avoiding robot with PING and Sharp IR

This is the first robot I've ever built, so I'm a total NOOB. I am using an arduino board with a motor control shield attached to it. I am also using a PING sensor. Now, I used the code from this website to get that running. However, now I want to add two Sharp IR sensors as well. My questions are: How do I connect these to the board? Will the source code I have for the PING work with the IR sensors? If not, any ideas on where i can find it? Thanks for the help.

I am wondering if anyone could take at look at this and let me know if it will be functional. I am using a PING in the center, an IR sensor on the left and right. I would like it to avoid obstacles. Thanks for the help.

// Begin Robot Code

int irLval; // Left IR
int irRval; // Right IR

int i; // Generic Counter
int x; // Generic Counter
int PLval; // Pulse Width for Left Servo
int PRval; // Pulse Width for Right Servo
int cntr; // Generic Counter Used for Determining amt. of Object Detections
int counter; // Generic Counter
int clrpth; // amt. of Milliseconds Of Unobstructed Path
int objdet; // Time an Object was Detected
int distance; // Distance to Object Detected via Ultrasonic Ranger
int oldDistance; // Previous Distance Value Read from Ultrasonic Ranger

float scale = 1.9866666666666666666666666666667; // Not Currently Used

int LeftPin = 6; // Left Servo
int RightPin = 9; // Right Servo
int irLPin = 0; // Analog 0; Left IR
int irRPin = 2; // Analog 2; Right IR

int ultraSoundSignal = 7; // Ultrasound signal pin
int val = 0; // Used for Ultrasonic Ranger
int ultrasoundValue = 0; // Raw Distance Val
int oldUltrasoundValue; // Not used
int pulseCount; // Generic Counter
int timecount = 0; // Echo counter

#define BAUD 9600
#define CmConstant 1/29.034

void setup() {
Serial.begin(9600);
pinMode(LeftPin, OUTPUT);
pinMode(RightPin, OUTPUT);

pinMode(irLPin, INPUT);
pinMode(irRPin, INPUT);
for(i = 0; i < 500; i++)
for(i = 0; i < 20; i++) {

delay(20);
}
ultrasoundValue = 600;
i = 0;
}

void loop()
{
//Scan();
Look();
Go();
}
void Look() {
irLval = analogRead(irLPin);
irRval = analogRead(irRPin);
//if(counter > 10) {
//counter = 0;
//readPing();
//}
if(irLval > 200) {
PLval = 850;
PRval = 820;
x = 5;
cntr = cntr + 1;
clrpth = 0;
objdet = millis();
}

else if(irRval > 200) {
PLval = 650;
PRval = 620;
x = 5;
cntr = cntr + 1;
clrpth = 0;
objdet = millis();

}
readPing();
if(ultrasoundValue < 500) {
cntr = cntr + 1;
{

x = 7;
PLval = 650;
PRval = 650;
Go();

x = 10;
PLval = 650;
PRval = 650;
Go();

x = 14;
PLval = 850;
PRval = 850;
Go();

x = 10;
PLval = 850;
PRval = 850;
Go();

x = 7;
PLval = 850;
PRval = 850;
Go();

}
}

if(cntr > 25 && clrpth < 2000) {
clrpth = 0;
cntr = 0;
}
}
void Go() {
for(i = 0; i < x; i++) {
digitalWrite(LeftPin, HIGH);
delayMicroseconds(PLval * 2);
digitalWrite(LeftPin, LOW);
digitalWrite(RightPin, HIGH);
delayMicroseconds(PRval * 2);
digitalWrite(RightPin, LOW);
delay(20);
}
}
void readPing() { // Get Distance from Ultrasonic Ranger
timecount = 0;
val = 0;
pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output

/* Send low-high-low pulse to activate the trigger pulse of the sensor


*/

digitalWrite(ultraSoundSignal, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal, LOW); // Holdoff

/* Listening for echo pulse


*/

pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input
val = digitalRead(ultraSoundSignal); // Append signal value to val
while(val == LOW) { // Loop until pin reads a high value
val = digitalRead(ultraSoundSignal);
}

while(val == HIGH) { // Loop until pin reads a high value
val = digitalRead(ultraSoundSignal);
timecount = timecount +1; // Count echo pulse time
}

/* Writing out values to the serial port


*/

ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue
}

// End

Upload it to the robot and run it. If the robot doesn't hit any obstacles it works. Otherwise, it doesn't.

Or, is there some reason you can't upload it to the robot?

A question, though. In the code that follows the readPing() function, Go() is called 5 times, with 5 different loop counts, but exactly the same values for the rest of the variables. It appears as though exactly the same thing would happen is you simply called Go() with a larger first argument. That is, the robot is going to go straight.