Arduino pro micro pins 18-21 as digital outputs?

Dear All,
I have a "generic’ arduino pro micro, with leds attached to pins 21, 20, 19 and 18.
However outputs are not behaving as I think they should.
I added serial print commands to debug the code and all the variables seem to be as expected, but I can’t light two leds at the same time as they should.
This is the situation predicted on the 4th IF of the attached code.
I have also attached the data printed to the serial port which confirms that the affected pin are 2o and 21, but only the LED connected to pin 20 is ON.

void lightLeds(){
//------Pump on Led--------
  if (flapState == 0) {digitalWrite(pumpLedPin, LOW);}
    else {digitalWrite(pumpLedPin, HIGH);}

//------Reservoir 1 level (cisterna)--------
if (levelDp[1] <= levelDpLow)
{
  Serial.println("Low Level " + String(levelDp[1]) + "LLL " + String(levelDpLow)+ "led pin " + String(lowRes1Pin));
  digitalWrite(lowRes1Pin, HIGH);
  digitalWrite(highRes1Pin, LOW);
}
if (levelDp[1] >= levelDpGood)
{
  Serial.println("High Level " + String(levelDp[1]) + "HLL " + String(levelDpGood)+ "led pin " + String(highRes1Pin));
  digitalWrite(highRes1Pin, HIGH);
  digitalWrite(lowRes1Pin, LOW);
}
if (levelDp[1] > levelDpLow && levelDp[1] < levelDpGood)
{
  Serial.println("Normal Level " + String(levelDp[1]) + "LLL " + String(levelDpLow)+ "HLL " + String(levelDpGood));
  Serial.println("High pin " + String(highRes1Pin) + "Low pin " + String(lowRes1Pin));
  digitalWrite(lowRes1Pin, HIGH);
  digitalWrite(highRes1Pin, HIGH);
}

and the serial data:

Normal Level 48LLL 30HLL 70
High pin 20Low pin 21
Normal Level 48LLL 30HLL 70
High pin 20Low pin 21

Any ideas?

I hope you have current limiting resistors between pins pins 21, 20, 19 and 18 and the LEDs.

Did you write a simple program to set those pins to output and turn them on, individually, with a 1 second delay between each turn on?

Paul

Yes there 1k resistors in series with the leds.
I haven’t tried the simple code yet.
Since I am new to Arduino (and programming in C),I thought I was making an obvious “beginners mistake“.