Need help on the coding with 2 LDR with 2 servo motors

HI guys I need some advice on the coding

I m trying to link 2 LDR to 2 servo motors but there s something wrong with the coding for it to work :
I have attached the breadboard connection

#include <Servo.h>

Servo myservo;

int ldr = A0; //input pin for sensor
int val; //variable for sensor value's
int thresh = 600; //threshold LDR
int pos = 0; //rest position

int ldr = A1; //input pin for sensor
int val; //variable for sensor value's
int thresh = 600; //threshold LDR
int pos = 0; //rest position

void setup()
{
myservo.attach(13); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
pinMode(ldr, INPUT);
myservo.write(pos); //write rest position

myservo.attach(12); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
pinMode(ldr, INPUT);
myservo.write(pos); //write rest position
}

void loop()
{
val = analogRead(ldr);
Serial.println(val);

if (val < thresh) { //compare threshold to sensor value
myservo.write(180); //move servo to position given by the amount of light
delay(300);
}

else if (val > thresh) { //compare threshold to sensor value
myservo.write(0); //move servo to position given by the amount of light
delay(300);
}
}

You end up with one LDR (on pin A1) and one servo (on pin 12). If you want 2 servos and 2 LDRs you need create the objects and name them differently. If you are going to copy and paste, at least get rid of redundant code.

// creates ONE servo object
Servo myservo;

int ldr = A0; //input pin for sensor
int ldr = A1; //input pin for sensor
// net result one LDR on pin A1
myservo.attach(13)
myservo.attach(12)
// net result one servo on pin 12 (you only declared one, anyway).

Please read the "how to use the forum" stickies to see how to format and post code.

If you want 2 servos and 2 LDRs you need create the objects and name them differently

Like you did? Two variables named ldr is not going to work.

I was showing in his code where they are the same.

Two variables named ldr is not going to work.

is what I wanted to point out.