Liquidcristal display & LED

I’m working on a RFID access control project and am running into a, I believe, strange problem:

When connecting LEDs only to my Arduino Mega 2560 I can control them perfectly. Connecting the liquidcristal display will also work but connecting both LED and LCD to my Arduino doesn’t allow me to manipulate the LEDs; they just don’t light up.

I haven’t come arround to conect my RFID reader but I fear I’ll have identical problems.

The final code will allow my Arduino to communicate with a Raspberry PI where a database is running with all RFID tags that are granted access. I’ve tested this over USB (the final version will be over ethernet) and I can make my Arduino request a lookup in the PI database and act on it correctly (green LED when access granted, red when not).

In the final code reading a valid RFID should light up a green LED and display a mesage on the LCD and then open a door.

The test code I’m using to verify if LCD and LED can work together is as follows:

#include <LiquidCrystal.h>

const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

int Sec;
int Calc;
int Cntr = 0;

void setup() {

  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);

  // Print a message to the LCD.
  lcd.print("Test LCD & LED");

}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print(Cntr);
  
  Serial.println(Cntr);
  Cntr++;
  digitalWrite(2, HIGH);
  Serial.println("LED 2 ON");
  digitalWrite(3, HIGH);

  delay(1000);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);

}

I don’t know if this is the correct forum but I didn’t see a better one.

You are turning the LEDs on, waiting 1 second, turning them off then loop() starts again and you immediately turn them on again with no delay, hence they appear to be on permanently

Connecting the liquidcristal display will also work but connecting both LED and LCD to my Arduino doesn't allow me to manipulate the LEDs; they just don't light up.

If they don't light up at all with this code, I guess it's a hardware problem. Post a wiring diagram of the complete setup (including power)!