How to connect two sensors to an arduino?

So I tried to connect 2 sensors to my arduino they are Sharp.IR sensors. I connected them and the values I’m getting should be different. They are about the same for both sensors when they should be different. Sensor 1 is located far away from the object so that values being 100-200 are reasonable however Sensor 2 is right in front of it and its still giving me 100-200 when it should be giving me 500-600, my guess is that one sensor is giving its values to both commands and I don’t know how to correct it.

#include <Keypad.h>
#include <Servo.h>
#include <SharpIR.h>
SharpIR sharp(A0, 25, 93, 1080);
SharpIR sharp1(A1, 25, 93, 1080);
int dis=sharp.distance();
const int LOL=A0;
const int LMAO=A1;
Servo myservo;


const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns


// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = {8, 7, 6, 5};
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = {4, 3, 2};

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define ledpin 13
#define ir A0
#define model 1080


void setup()
{
  pinMode(ledpin,OUTPUT);
  digitalWrite(ledpin, HIGH);
  Serial.begin(9600);
  myservo.attach(10);
}

void loop()
{
  myservo.write(90);
  char key = kpd.getKey();
  if(key)  // Check for a valid key.
  Serial.print("Button Pressed: ");
  Serial.println(key);

  {int sensorvalue= analogRead(LMAO);
  int dist=map(sensorvalue, 105.5, 602.5, 46.1, 0);
  Serial.print("Analog Reading 1.0: ");
 Serial.print(sensorvalue);
  Serial.print(" Centemeters: ");
  Serial.print(dist);
  Serial.println("cm");
  delay(10);}
  
  {int sensorValue= analogRead(LOL);
  int dist=map(sensorValue, 105.5, 602.5, 46.1, 0);
  Serial.print("Analog Reading 2.0: ");
  Serial.print(sensorValue);
  Serial.print(" Centemeters: ");
  Serial.print(dist);
  Serial.println("cm");
  delay(10);}

  {
    int sensorValue= analogRead(LOL);
    int sensorvalue= analogRead(LMAO);
    switch (key)
      {
      { 

       case '1':
       
       do 
      {sensorValue= analogRead(LOL);  
       int dist=map(sensorValue, 105.5, 606.52, 46.1, 0);
       Serial.print("Analog Reading: ");
       Serial.print(sensorValue);
       Serial.print(" Centemeters: ");
       Serial.print(dist);
       Serial.println("cm");
       delay(10);
       myservo.write(180);
        }
       while(sensorValue < 600);
       break;
       }
      
      case '2':   
      if(10<sensorValue && sensorValue<155)
       {sensorValue= analogRead(LOL); 
       int dist=map(sensorValue, 105.5, 606.52, 46.1, 0);
       Serial.print("Analog Reading: ");
       Serial.print(sensorValue);
       Serial.print(" Centemeters: ");
       Serial.print(dist);
       Serial.println("cm");
       delay(10);
       myservo.write(180);
        }
      else if(200<sensorValue &&sensorValue<650)
      {sensorValue= analogRead(LOL); 
       int dist=map(sensorValue, 105.5, 606.52, 46.1, 0);
       Serial.print("Analog Reading: ");
       Serial.print(sensorValue);
       Serial.print(" Centemeters: ");
       Serial.print(dist);
       Serial.println("cm");
       delay(10);
       myservo.write(0);
      }
      else
      {myservo.write(90);}
      
       break;

      case '3':
         do 
      {sensorvalue= analogRead(LMAO);  
       int dist=map(sensorvalue, 105.5, 606.52, 46.1, 0);
       Serial.print("Analog Reading: ");
       Serial.print(sensorvalue);
       Serial.print(" Centemeters: ");
       Serial.print(dist);
       Serial.println("cm");
       delay(1);
       myservo.write(0);
        }
       while(sensorvalue < 600);
       break;

      case '4':
         myservo.write(0);
         delay(5000);
         break;

      case '5':
          myservo.write(180);
          delay(5000);
          break;

      case '6':
           myservo.write(0);
           delay(28000);
           break;
        
      case '*':
        //digitalWrite(ledpin, LOW);
        break;
      case '#':
        //digitalWrite(ledpin, HIGH);
        break;
      //default:
       
    
   }
  }
}

Your brace placements looks odd
{ }

A further suggestion, from one "newbie" to another, first delete all code EXCEPT read the sensors and print to serial and test. Once you have got each sensor reading correctly them start adding the comparisons, then the keypad etc.

Also maybe not start a new topic each time? I am interested in helping and learning from your project (I am using Ultrasonic and IR sensing on a mini robot) but trying to keep track of all your new topics for the same problems is frustrating.

Kiwi_Bloke:
A further suggestion, from one "newbie" to another, first delete all code EXCEPT read the sensors and print to serial and test. Once you have got each sensor reading correctly them start adding the comparisons, then the keypad etc.

Also maybe not start a new topic each time? I am interested in helping and learning from your project (I am using Ultrasonic and IR sensing on a mini robot) but trying to keep track of all your new topics for the same problems is frustrating.

Okay from now on im posting all updates and questions to this thread:- http://forum.arduino.cc/index.php?topic=371102.msg2559099#msg2559099
sorry for any confusion and your frustration

UsmanJ:
Okay from now on im posting all updates and questions to this thread:- http://forum.arduino.cc/index.php?topic=371102.msg2559099#msg2559099
sorry for any confusion and your frustration

Yup, thread locked.