Why is my code not working?

This is what its supposed to do.

Read the voltage coming into the analogue inputs 0, 1, and 2. If the voltage drops under 2 volts in input 0 the yellow light will turn on while the other LED's are off, if the input in 0, and 1 go below 2 volts the green light will turn on, and the other LED's will be off, and if the voltage in 1,2 and, 3 go below 2 volts, than the red light will turn on and the other led's will be off.

The code compiles but is just not working. I checked the voltages going into the analogue inputs with a volt meter and everything seems to be fine.

int led1 = 4; //Yellow
int led2 = 5; // Green
int led3 = 6; // Red
int led4 = 12;
int led5 = 13;
void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
void loop() {
unsigned int d1 = analogRead(0);
unsigned int d2 = analogRead(1);
unsigned int d3 = analogRead(2);

if ((2 <= d1) && (2 <= d2) && (2 <= d3))
{
digitalWrite(led1, LOW); //Yellow
digitalWrite(led2, LOW); // Green
digitalWrite(led3, LOW); // Red
}

else if ((d1 <= 2) && (2 <= d2) && (2 <= d3))
{
digitalWrite(led1, HIGH); //Yellow
digitalWrite(led2, LOW); // Green
digitalWrite(led3, LOW); // Red
}

else if ((d1 <= 2) && (d2 <= 2) && (2 <= d2))
{
digitalWrite(led1, LOW); //Yellow
digitalWrite(led2, HIGH); // Green
digitalWrite(led3, LOW); // Red
}

else if ((d1 <= 2) && (d2 <= 2) && (d3 <= 2))
{
digitalWrite(led1, LOW); //Yellow
digitalWrite(led2, LOW); // Green
digitalWrite(led3, HIGH); // Red
}
}

So what does your code actually do ?

There seems to be no good reason to make d1,d2,d3 unsigned.

If the voltage drops under 2 volts

analogRead( ) returns a number between 0 and 1023, where 0 corresponds to 0 volts analog input, and 1023 corresponds to 5V analog input.

2 volts input should result in a return value from analogRead( ), of (2/5)*1023 which is 408, or something like that.

All those 2's in your if statements need to be replaced by 408.

After 22 posts you should know how to post properly to this Forum. Since that's not the case, read Nick Gammon's two posts at the top of this Forum and use Ctrl-T to format your code before you post it and use code tags when posting.