Different Brightness between 2 LEDs

I have an ATtiny85 that is connected to a 10K pot and has 2 LEDs. One LED is HIGH all of the time and the other fades in and out depending on the position of the potentiometer. The odd thing is that when the potentiometer mapping to the PWM LED is completely on (255) it is about 50% as bright as the LED that is always on. They have the exact same resistor and when I switch the LEDs the same effect happens so it is not an issue with the LEDs. Additionally I have tried it with the internal 8mhz clock and an external 16mhz clock with the same effect. Any thoughts?

Here is my code

void setup(){
 // Serial.begin(9600);
  pinMode(1,OUTPUT); // led is always on
}

void loop(){
  int sensor_value = analogRead(A1);
  int output = map(sensor_value,0,1023,0,255);
  analogWrite(0,output); // this led is never as bright
  digitalWrite(1,HIGH);
//  Serial.println(output);
}

What do you get if you do “analogWrite(0,255)”?

analogWrite(0,255);

Produced 2 LEDs of the same brightness. That way worked! I double checked all the connections in the breadboard and switched out the LEDs, but the problem still persists with the potentiometer.

There is no logical explanation for this is there?

I checked that the potentiometer was correctly working by sending out the values to the Serial monitor via Arduino Uno

Do you have a multimeter ? You could test voltage at the LED. You exchanged the LEDs so you ruled out differences in the LEDs themselves. Did you also change ports in the sketch ? So do the dim function om pin 1 and the ON function on pin 0 ?

I wouldn't use a variable called output (even if it's lowercase), so try what happens if you give it a name that doesn't double a function or any other word used in IDE.

There is no logical explanation for this is there?

Well we don't believe in the supernatural around here so there is a logical explanation.

The first thing to do is to swap the diodes over and have everything else the same. Do you still see a difference?

Next look at the voltage waveform across each diode, does that show you anything.