LCD error (nothing appear on LCD)

hi i’m ikhsan rino wijaya. i have a problem regarding about LCD. i use i2c LCD. the problem is the text doesnt appear in LCD. whereas i try simple code and it can be appeared in LCD. when i change with the complex one , nothing appear. i hope you guys have any suggestions to me. thank you very much

#include <Wire.h>
#include <Array.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity
int led = 9;
int ir = 8;
int sensor = A0;
float kadarhb, kadarspo2;
int arrayled[250];
int arrayir[250];

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);  // put your setup code here, to run once:
pinMode(ir, OUTPUT);
pinMode(sensor, INPUT);
//Serial.begin(9600);
  lcd.begin(16,2);
    lcd.backlight();


}

void loop() {
  // put your main code here, to run repeatedly:
int  z,z2=0;
  int k=120;
  int k2=50;
  
  for ( int i=0; i<500; i++)
{
  digitalWrite(ir,HIGH);
 digitalWrite(led,LOW);
  delay(10);
if(i>300)
 {
  arrayir[i] = analogRead(sensor);
  //Serial.println(arrayir[i]);

  if((arrayir[i] >z) && (arrayir[i]<150))
  {
  z = arrayir[i];
  }
if ((arrayir[i] <= k) && (arrayir[i] > 10))
   {
    k = arrayir[i]; 
   }
  }
  digitalWrite(ir,LOW);
  digitalWrite(led,LOW);
  delay(10);
  }


  for (int j=0; j<500; j++)
{
  digitalWrite(ir,LOW);
  digitalWrite(led,HIGH);
  delay(10);

  if(j>300)
  {
  arrayled[j] = analogRead(sensor); 
 //Serial.println(arrayled[j]);
  if((arrayled[j] >z2) && (arrayled[j]<60))
  {
  z2 = arrayled[j];
  }

   if ((arrayled[j] < k2) && (arrayled[j] > 20))
   {
    k2 = arrayled[j]; 
   }
  }
  digitalWrite(ir,LOW);
  digitalWrite(led,LOW);
  delay(10);
}

//Serial.print("nilai maks LED merah = ");
//Serial.println(z2);
//Serial.print("nilai min LED merah = ");
//Serial.println(k2);
//Serial.print("nilai maks LED infrared = ");
//Serial.println(z);
//Serial.print("nilai min LED infrared = ");
//Serial.println(k);

float led= z2/k2;
float infra = z/k;


float rasio = led/infra;

if(rasio > 1)
{
  rasio =0.857;
}

if (rasio < 0.4)
{
rasio=rasio*2;
}

kadarspo2 = 110 -(25*rasio);
//Serial.print("rasio =");
//Serial.println(rasio);
kadarhb = (kadarspo2/100)*15;

lcd.setCursor(0,0);
lcd.print("spo2 =");
lcd.setCursor(7,0);
lcd.print(kadarspo2);
lcd.setCursor(0,1);
lcd.print("hb =");
lcd.setCursor(5,1);
lcd.print(kadarhb);

delay(5000);

}
...
int arrayir[250];
...

...
...
  for ( int i = 0; i < 500; i++)
  {
    ...
    ...

    if (i > 300)
    {
      arrayir[i] = analogRead(sensor);

It’s not such a good idea to write outside the boundaries of an array.

Your code crashes and hence you don’t see anything.

PS
Seems to be the same problem as in your other thread. Do you understand what was pointed out in there?

For more on this, see here