What is wrong, using Arduino R4wifi

#include <Servo.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  { "1", "2", "3", "A" },
  { "4", "5", "6", "B" },
  { "7", "8", "9", "C" },
  { "*", "0", "#", "D" }
};
byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0 * 27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

void setup() {
  // put your setup code here, to run once:
  servo.attach(12);
  lcd.begin();

  lcd.print("Enter the pass");
  servo.write(0);
  lcdsetCursor(0, 1);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (door == 0) {
    char key = kp.getKey();
    if (key == "C") {
      servo.write(0);
      i = counter = 0;
      lcd.clear();
      lcd.print("Enter the pass");
      lcd.setCursor(0, 1);
      door = 1;
    }
  } else {
    char key = kp.getKey();
    if (key >= "0" && key <= "9") {
      lcd.print("*");
      pass[i] = key;
      i++;
    } else if (key == "D") {
      if (i == number) {
        for (int j = 0; j < number; j++) {
          if (pass[j] == correctPass[j]) counter++;
        }
        if (counter == number) {
          correct();
        } else {
          wrong();
        }
      } else {
        wrong();
      }
    }
  }
}

void wrong() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Wrong Pass   ");
  lcd.setCursor(0, 1);
  lcd.print("  Try Again   ");
  delay(2000);
  i = 0;
  counter = 0;
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Enter the Pass");
  lcd.setCursor(0, 1);
}
void correct() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Correct Pass   ");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("The door is open");
  lcd.setCursor(0, 1);
  lcd.print("<C> To close");
  servo.write(90);
  delay(1000);
  i = 0;
  counter = 0;
  door = 0;
}

error:
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:2:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:45:1: error: expected unqualified-id before 'do'
do {
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:51:2: error: expected unqualified-id before 'while'
}while(0)
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:14:1: error: too many initializers for 'char [4]'
};
^
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:14:1: error: too many initializers for 'char [4]'
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:14:1: error: too many initializers for 'char [4]'
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:14:1: error: too many initializers for 'char [4]'
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:20:36: error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
LiquidCrystal_I2C lcd(0 * 27, 16, 2);
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:53:4: note: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'
LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
^~~~~~~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void setup()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:32:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
lcd.begin();
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate: virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
^~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate expects 3 arguments, 0 provided
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:36:3: error: 'lcdsetCursor' was not declared in this scope
lcdsetCursor(0, 1);
^~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void loop()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:43:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key == "C") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:53:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key >= "0" && key <= "9") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:53:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key >= "0" && key <= "9") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:57:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
} else if (key == "D") {
^~~
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5
Not used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\LiquidCrystal_I2C
exit status 1

Compilation error: too many initializers for 'char [4]'

Did you mean

char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },

etc... ?

I changed to this:

#include <Servo.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },
  { '4', '5', '6', 'A' },
  { '7', '8', '9', 'A' },
  { '*', '0', '#', 'D' }
};
byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0 * 27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

void setup() {
  // put your setup code here, to run once:
  servo.attach(12);
  lcd.begin();

  lcd.print("Enter the pass");
  servo.write(0);
  lcdsetCursor(0, 1);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (door == 0) {
    char key = kp.getKey();
    if (key == "C") {
      servo.write(0);
      i = counter = 0;
      lcd.clear();
      lcd.print("Enter the pass");
      lcd.setCursor(0, 1);
      door = 1;
    }
  } else {
    char key = kp.getKey();
    if (key >= "0" && key <= "9") {
      lcd.print("*");
      pass[i] = key;
      i++;
    } else if (key == "D") {
      if (i == number) {
        for (int j = 0; j < number; j++) {
          if (pass[j] == correctPass[j]) counter++;
        }
        if (counter == number) {
          correct();
        } else {
          wrong();
        }
      } else {
        wrong();
      }
    }
  }
}

void wrong() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Wrong Pass   ");
  lcd.setCursor(0, 1);
  lcd.print("  Try Again   ");
  delay(2000);
  i = 0;
  counter = 0;
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Enter the Pass");
  lcd.setCursor(0, 1);
}
void correct() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Correct Pass   ");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("The door is open");
  lcd.setCursor(0, 1);
  lcd.print("<C> To close");
  servo.write(90);
  delay(1000);
  i = 0;
  counter = 0;
  door = 0;
}

and get this error:
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:2:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:45:1: error: expected unqualified-id before 'do'
do {
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:51:2: error: expected unqualified-id before 'while'
}while(0)
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:20:36: error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
LiquidCrystal_I2C lcd(0 * 27, 16, 2);
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:53:4: note: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'
LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
^~~~~~~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void setup()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:32:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
lcd.begin();
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate: virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
^~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate expects 3 arguments, 0 provided
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:36:3: error: 'lcdsetCursor' was not declared in this scope
lcdsetCursor(0, 1);
^~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void loop()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:43:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key == "C") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:53:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key >= "0" && key <= "9") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:53:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
if (key >= "0" && key <= "9") {
^~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:57:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
} else if (key == "D") {
^~~
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5
Not used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\LiquidCrystal_I2C
exit status 1

Compilation error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]

So it's got rid of the errors due to using strings instead of chars in the initialisers.

I think you've made the same mistake elsewhere; eg,

Should be
if (key == 'C') {

But there do also seem to be errors in the Keypad.h header

#include <Servo.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },
  { '4', '5', '6', 'A' },
  { '7', '8', '9', 'A' },
  { '*', '0', '#', 'D' }
};
byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0 * 27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

void setup() {
  // put your setup code here, to run once:
  servo.attach(12);
  lcd.begin();

  lcd.print("Enter the pass");
  servo.write(0);
  lcdsetCursor(0, 1);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (door == 0) {
    char key = kp.getKey();
    if (key == 'C') {
      servo.write(0);
      i = counter = 0;
      lcd.clear();
      lcd.print("Enter the pass");
      lcd.setCursor(0, 1);
      door = 1;
    }
  } else {
    char key = kp.getKey();
    if (key >= '0' && key <= '9') {
      lcd.print('*');
      pass[i] = key;
      i++;
    } else if (key == 'D') {
      if (i == number) {
        for (int j = 0; j < number; j++) {
          if (pass[j] == correctPass[j]) counter++;
        }
        if (counter == number) {
          correct();
        } else {
          wrong();
        }
      } else {
        wrong();
      }
    }
  }

  void wrong() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Wrong Pass   ");
    lcd.setCursor(0, 1);
    lcd.print("  Try Again   ");
    delay(2000);
    i = 0;
    counter = 0;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Enter the Pass");
    lcd.setCursor(0, 1);
  }
  void correct() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Correct Pass   ");
    delay(2000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("The door is open");
    lcd.setCursor(0, 1);
    lcd.print("<C> To close");
    servo.write(90);
    delay(1000);
    i = 0;
    counter = 0;
    door = 0;
  }

error:
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:2:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:45:1: error: expected unqualified-id before 'do'
do {
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:51:2: error: expected unqualified-id before 'while'
}while(0)
^
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Keypad\src/Keypad.h:43:30: note: in expansion of macro '_mypinMode'
#define pinMode(_pin, _mode) _mypinMode(_pin, _mode)
^~~~~~~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/I2CIO.h:73:9: note: in expansion of macro 'pinMode'
void pinMode ( uint8_t pin, uint8_t dir );
^~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:20:36: error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]
LiquidCrystal_I2C lcd(0 * 27, 16, 2);
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:53:4: note: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'
LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
^~~~~~~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void setup()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:32:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
lcd.begin();
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate: virtual void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
^~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5/LiquidCrystal_I2C.h:110:17: note: candidate expects 3 arguments, 0 provided
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:36:3: error: 'lcdsetCursor' was not declared in this scope
lcdsetCursor(0, 1);
^~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino: In function 'void loop()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:63:11: error: 'correct' was not declared in this scope
correct();
^~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:63:11: note: suggested alternative: 'correctPass'
correct();
^~~~~~~
correctPass
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:65:11: error: 'wrong' was not declared in this scope
wrong();
^~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:65:11: note: suggested alternative: 'ulong'
wrong();
^~~~~
ulong
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:68:9: error: 'wrong' was not declared in this scope
wrong();
^~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:68:9: note: suggested alternative: 'ulong'
wrong();
^~~~~
ulong
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:73:16: error: a function-definition is not allowed here before '{' token
void wrong() {
^
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:87:18: error: a function-definition is not allowed here before '{' token
void correct() {
^
C:\Users\ulfer\OneDrive\Dokument\Arduino\Doorlock\Doorlock.ino:102:3: error: expected '}' at end of input
}
^
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\Newliquidcrystal_1.3.5
Not used: C:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\LiquidCrystal_I2C
exit status 1

Compilation error: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]

There still seem to be errors in the Keypad.h header.
And others?

Are you sure all your libraries are compatible with the R4?

eg, LiquidCrystal_I2C seems to be AVR only:

I don't know

Then you really need to check!

#include <Servo.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },
  { '4', '5', '6', 'A' },
  { '7', '8', '9', 'A' },
  { '*', '0', '#', 'D' }
};
byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0 * 27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

void setup() {
  // put your setup code here, to run once:
  servo.attach(12);
  lcd.begin();

  lcd.print("Enter the pass");
  servo.write(0);
  lcdsetCursor(0, 1);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (door == 0) {
    char key = kp.getKey();
    if (key == 'C') {
      servo.write(0);
      i = counter = 0;
      lcd.clear();
      lcd.print("Enter the pass");
      lcd.setCursor(0, 1);
      door = 1;
    }
  } else {
    char key = kp.getKey();
    if (key >= '0' && key <= '9') {
      lcd.print('*');
      pass[i] = key;
      i++;
    } else if (key == 'D') {
      if (i == number) {
        for (int j = 0; j < number; j++) {
          if (pass[j] == correctPass[j]) counter++;
        }
        if (counter == number) {
          correct();
        } else {
          wrong();
        }
      } else {
        wrong();
      }
    }
  }

  void wrong() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Wrong Pass   ");
    lcd.setCursor(0, 1);
    lcd.print("  Try Again   ");
    delay(2000);
    i = 0;
    counter = 0;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Enter the Pass");
    lcd.setCursor(0, 1);
  }
  void correct() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Correct Pass   ");
    delay(2000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("The door is open");
    lcd.setCursor(0, 1);
    lcd.print("<C> To close");
    servo.write(90);
    delay(1000);
    i = 0;
    counter = 0;
    door = 0;
  }

I got this error when I tried the last one.
WARNING: library LiquidCrystal I2C claims to run on avr architecture(s) and may be incompatible with your current board which runs on renesas_uno architecture(s).
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino: In function 'void setup()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:32:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
lcd.begin();
^
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:3:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );
^~~~~
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:36:3: error: 'lcdsetCursor' was not declared in this scope
lcdsetCursor(0, 1);
^~~~~~~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino: In function 'void loop()':
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:63:11: error: 'correct' was not declared in this scope
correct();
^~~~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:63:11: note: suggested alternative: 'correctPass'
correct();
^~~~~~~
correctPass
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:65:11: error: 'wrong' was not declared in this scope
wrong();
^~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:65:11: note: suggested alternative: 'ulong'
wrong();
^~~~~
ulong
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:68:9: error: 'wrong' was not declared in this scope
wrong();
^~~~~
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:68:9: note: suggested alternative: 'ulong'
wrong();
^~~~~
ulong
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:73:16: error: a function-definition is not allowed here before '{' token
void wrong() {
^
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:87:18: error: a function-definition is not allowed here before '{' token
void correct() {
^
C:\Users\ulfer\OneDrive\Dokument\Arduino\doorlocktest\doorlocktest.ino:102:3: error: expected '}' at end of input
}
^

exit status 1

Compilation error: no matching function for call to 'LiquidCrystal_I2C::begin()'

It's telling you it's not compatible:

ok so it can't get it to work.

You need to either find libraries that are compatible with the Arduino you're using, or use an Arduino that's compatible with the libraries you're using.

following compiles w/o errors

  • replace lcd.begin() with init()
  • missing brace
# include <Servo.h>
# include <Keypad.h>
# include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
    { '1', '2', '3', 'A' },
    { '4', '5', '6', 'A' },
    { '7', '8', '9', 'A' },
    { '*', '0', '#', 'D' }
};


byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

// -----------------------------------------------------------------------------
void setup() {
    // put your setup code here, to run once:
    servo.attach(12);
    lcd.init();

    lcd.print("Enter the pass");
    servo.write(0);
    lcd.setCursor(0, 1);
}


void loop() {
    // put your main code here, to run repeatedly:
    if (door == 0) {
        char key = kp.getKey();
        if (key == 'C') {
            servo.write(0);
            i = counter = 0;
            lcd.clear();
            lcd.print("Enter the pass");
            lcd.setCursor(0, 1);
            door = 1;
        }
    } else {
        char key = kp.getKey();
        if (key >= '0' && key <= '9') {
            lcd.print('*');
            pass[i] = key;
            i++;
        } else if (key == 'D') {
            if (i == number) {
                for (int j = 0; j < number; j++) {
                    if (pass[j] == correctPass[j]) counter++;
                }
                if (counter == number) {
                    correct();
                } else {
                    wrong();
                }
            } else {
                wrong();
            }
        }
    }
}


void wrong() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Wrong Pass   ");
    lcd.setCursor(0, 1);
    lcd.print("  Try Again   ");
    delay(2000);
    i = 0;
    counter = 0;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Enter the Pass");
    lcd.setCursor(0, 1);
}

void correct() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Correct Pass   ");
    delay(2000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("The door is open");
    lcd.setCursor(0, 1);
    lcd.print("<C> To close");
    servo.write(90);
    delay(1000);
    i = 0;
    counter = 0;
    door = 0;
}

Are you compiling for UNO R4 ?

i corrected syntax errors, not dependent on hardware

Now it almost works, I get Enter the Pass * but when I type in numbers it doesn't work, it just says a lot of ********. And the LCD display is pretty dark.

# include <Servo.h>
# include <Keypad.h>
# include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
    { '1', '2', '3', 'A' },
    { '4', '5', '6', 'A' },
    { '7', '8', '9', 'A' },
    { '*', '0', '#', 'D' }
};


byte rowPins[ROWS] = { 7, 6, 5, 4 };
byte colPins[COLS] = { 3, 2, 1, 0 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

// -----------------------------------------------------------------------------
void setup() {
    // put your setup code here, to run once:
    servo.attach(12);
    lcd.init();

    lcd.print("Enter the pass");
    servo.write(0);
    lcd.setCursor(0, 1);
}


void loop() {
    // put your main code here, to run repeatedly:
    if (door == 0) {
        char key = kp.getKey();
        if (key == 'C') {
            servo.write(0);
            i = counter = 0;
            lcd.clear();
            lcd.print("Enter the pass");
            lcd.setCursor(0, 1);
            door = 1;
        }
    } else {
        char key = kp.getKey();
        if (key >= '0' && key <= '9') {
            lcd.print('*');
            pass[i] = key;
            i++;
        } else if (key == 'D') {
            if (i == number) {
                for (int j = 0; j < number; j++) {
                    if (pass[j] == correctPass[j]) counter++;
                }
                if (counter == number) {
                    correct();
                } else {
                    wrong();
                }
            } else {
                wrong();
            }
        }
    }
}


void wrong() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Wrong Pass   ");
    lcd.setCursor(0, 1);
    lcd.print("  Try Again   ");
    delay(2000);
    i = 0;
    counter = 0;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Enter the Pass");
    lcd.setCursor(0, 1);
}

void correct() {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Correct Pass   ");
    delay(2000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("The door is open");
    lcd.setCursor(0, 1);
    lcd.print("<C> To close");
    servo.write(90);
    delay(1000);
    i = 0;
    counter = 0;
    door = 0;
}

Are you still getting the warning?

WARNING: library LiquidCrystal I2C claims to run on avr architecture(s) and may be incompatible with your current board which runs on renesas_uno architecture(s).

isn't that what you wrote the code below to do?

No, I don't get a warning now, I've changed the connections of the keypad a bit and changed the code a bit. It says enter the pass but nothing happens when I type 1234

#include <Wire.h>
#include <Servo.h>
#include <Keypad.h>
#include <LiquidCrystal_I2C.h>

Servo servo;

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },
  { '4', '5', '6', 'A' },
  { '7', '8', '9', 'A' },
  { '*', '0', '#', 'D' }
};


byte rowPins[ROWS] = { 9, 8, 7, 6 };
byte colPins[COLS] = { 5, 4, 3, 2 };

Keypad kp = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x27, 16, 2);

char correctPass[] = "1234";
int number = sizeof(correctPass) - 1;
char pass[sizeof(correctPass) - 1];
int i = 0, counter = 0;

bool door = 1;

// -----------------------------------------------------------------------------
void setup() {
  // put your setup code here, to run once:
  servo.attach(12);
  lcd.init();

  lcd.print("Enter the pass");
  servo.write(0);
  lcd.setCursor(0, 1);
}


void loop() {
  // put your main code here, to run repeatedly:
  if (door == 0) {
    char key = kp.getKey();
    if (key == 'C') {
      servo.write(0);
      i = counter = 0;
      lcd.clear();
      lcd.print("Enter the pass");
      lcd.setCursor(0, 1);
      door = 1;
    }
  } else {
    char key = kp.getKey();
    if (key >= '0' && key <= '9') {
      lcd.print('*');
      pass[i] = key;
      i++;
    } else if (key == 'D') {
      if (i == number) {
        for (int j = 0; j < number; j++) {
          if (pass[j] == correctPass[j]) counter++;
        }
        if (counter == number) {
          correct();
        } else {
          wrong();
        }
      } else {
        wrong();
      }
    }
  }
}


void wrong() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Wrong Pass   ");
  lcd.setCursor(0, 1);
  lcd.print("  Try Again   ");
  delay(2000);
  i = 0;
  counter = 0;
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Enter the Pass");
  lcd.setCursor(0, 1);
}

void correct() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Correct Pass   ");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("The door is open");
  lcd.setCursor(0, 1);
  lcd.print("<C> To close");
  servo.write(90);
  delay(1000);
  i = 0;
  counter = 0;
  door = 0;
}