Some LEDs dimmer than others

Hi,

I have five LEDs wired individually to pins on an Arduino with 220 ohm resistors. For some reason, the LEDs connected to pins 2 and 3 are dimmer than the others. I tried re-arranging the LEDs to see if there was something wrong with them, but the LEDs connected to pins 2 and 3 are always dimmer. I also tried connecting to different pins on the Arduino. Below is an image of the connections. Any help would be greatly appreciated.

Edit: The sketch is below

#include <Wire.h>
#include "SparkFun_BMA400_Arduino_Library.h"

BMA400 accelerometer;

uint8_t i2cAddress = BMA400_I2C_ADDRESS_DEFAULT; 

double y;
double prevY = 0;

int pos;
int n = 100;

int leds[5] = { 2, 3, 4, 5, 6 };

void setup()
{
    Serial.begin(115200);

    Wire.begin();

    while(accelerometer.beginI2C(i2cAddress) != BMA400_OK)
    {
        Serial.println("Error: BMA400 not connected, check wiring and I2C address!");
        delay(1000);
    }

    Serial.println("BMA400 connected!");

    for (int i = 2; i <= 6; i++) {
      pinMode(leds[i], OUTPUT);
    }
}

void loop() {
  for (int i = 0; i < n; i++) {
    accelerometer.getSensorData();

    y += accelerometer.data.accelY;
  }

  y /= n;
    
  if (y - prevY > 0.03 || prevY - y > 0.03) {
    if (y < 0) {
      if (pos > 0) 
      pos--;
    } else {
      if (pos < 5)
        pos++;
    }
  } 

  toggleLEDs(pos);

   prevY = y;

   Serial.println((String) pos + ", " + (String) y);
}

void toggleLEDs(int i) {
  int ledOn;

  switch (i) {
    case 0: ledOn = 6; break;
    case 1: ledOn = 5; break;
    case 2: ledOn = 4; break;
    case 3: ledOn = 3; break;
    case 4: ledOn = 2; break;
    default: ledOn = 0; break;
  }

  for (int i = 2; i <= 8; i++) {
    if (i == ledOn) digitalWrite(ledOn, HIGH);
    else digitalWrite(i, LOW);
  }
}

Please post the sketch that you are running, using code tags when you do

Thank you for your response. I updated my original post.

    for (int i = 0; i <= 4; i++) {
      pinMode(leds[i], OUTPUT);

Now you have seen @LarryD 's explanation, you may be wondering why the LEDs on pins 2 and 3 lit at all.

It's because if you use digitalWrite(pin, HIGH) on a pin which has not been set as OUTPUT, what happens is that the internal pull-up resistor on that pin gets activated (same as using INPUT_PULLUP mode). The internal pull-ups have quite high resistance values (30K~50K Ohms) and so only a small current flows through the LED and it glows dimly.