This is the code .
//____________________________________ IR reciever
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define rightMotor1 4
#define rightMotor2 5
#define leftMotor1 12
#define leftMotor2 13
#define motorPower1 40
#define motorPower2 41
#include <NewPing.h>
#define TRIGGER_PIN1Â 9Â // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN1Â Â 8Â // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE1 200// Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
#define TRIGGER_PIN2Â 7Â // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN2Â Â 6Â // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE2 200// Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar1(TRIGGER_PIN1, ECHO_PIN1, MAX_DISTANCE1); // NewPing setup of pins and maximum distance.
NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE2);
// _______________________________________________________________________________________
void setup(){
Â
 irrecv.enableIRIn(); // beginig the reciever ----------
Â
Â
 // ----------------- motor initialisation ----------------------
Â
 pinMode(rightMotor1, OUTPUT);
 pinMode(rightMotor2, OUTPUT);
 pinMode(leftMotor1, OUTPUT);
 pinMode(leftMotor2, OUTPUT);
 pinMode(motorPower1, OUTPUT);
 pinMode(motorPower2, OUTPUT);
Â
Â
Â
Â
}
void loop(){
Â
Â
 if (irrecv.decode(&results)) {
  Serial.println(results.value, HEX);
  irrecv.resume();
     Â
       if (results.value == 1 || results.value == 801 ){ // 1 pressed
       Â
        // run the line following code
        LineFollowing();
       }
       else if (results.value == 2 || results.value == 802 ){ // 2 pressed
       Â
        // run the Obstacle avoider
         ObstacleAvoider();
       }
     Â
}
}
void LineFollowing(){
// UNDER PROGRESS
}
Â
 void ObstacleAvoider(){
  unsigned int uS1 = sonar1.ping();
unsigned int uS2 = sonar2.ping();
 Â
  if (uS1 / US_ROUNDTRIP_CM >= 50 && uS2 / US_ROUNDTRIP_CM >= 50 ){
  stop();
 }
 else if (uS1 / US_ROUNDTRIP_CM <= 50 && uS2 / US_ROUNDTRIP_CM >= 50 ){
  rightTurn();
 }
 else if (uS1 / US_ROUNDTRIP_CM >= 50 && uS2 / US_ROUNDTRIP_CM <= 50 ){
  leftTurn();
 }
 else if (uS1 / US_ROUNDTRIP_CM <= 50 && uS2 / US_ROUNDTRIP_CM <= 50 ){
  forward();
 }
 }
 Â
Â
 // _________________________________________________________________________
 void stop(){
 Â
  digitalWrite(motorPower1, LOW);
 digitalWrite(motorPower2, LOW);
}
void forward(){
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(rightMotor1, HIGH);
 digitalWrite(rightMotor2, LOW);
//Â analogWrite(rightMotorPWM, 100);
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(leftMotor1, HIGH);
 digitalWrite(leftMotor2, LOW);
 //analogWrite(leftMotorPWM, 100);
}
void back(){
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(rightMotor1, LOW);
 digitalWrite(rightMotor2, HIGH);
// analogWrite(rightMotorPWM, 100);
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(leftMotor1, LOW);
 digitalWrite(leftMotor2, HIGH);
// analogWrite(leftMotorPWM, 100);
}
void rightTurn(){
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(rightMotor1, LOW);
 digitalWrite(rightMotor2, HIGH);
// analogWrite(rightMotorPWM, 100);
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(leftMotor1, HIGH);
 digitalWrite(leftMotor2, LOW);
//Â analogWrite(leftMotorPWM, 100);
}
void leftTurn(){
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(rightMotor1, HIGH);
 digitalWrite(rightMotor2, LOW);
// analogWrite(rightMotorPWM, 100);
 digitalWrite(motorPower1, HIGH);
 digitalWrite(motorPower2, HIGH);
 digitalWrite(leftMotor1, LOW);
 digitalWrite(leftMotor2, HIGH);
// analogWrite(leftMotorPWM, 100);
}
//_____________________________________________________________________________________
Please Try Sorting my problem
