PLEASE HELP! My code wont running every i add LCD i2c code

greeting kind heated person. I have a trouble with my source code it couldn't process the fuzzy and then the code won't loop anymore every time I use the LCD library and output it on LCD. note I'm using LCD 16x2 with i2c, I've been using a simple program to output it on LCD without any sensor and fuzzy and it can. please help me kind-hearted person :cry:

#include <Fuzzy.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
//#include <LiquidCrystal_I2C.h>
//
//LiquidCrystal_I2C lcd(0x27, 16, 2);
#define analogInPin  A0  // Analog input pin 
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
const int capteur_D = 4;
const int RELAY_PIN = 7;  
int val_analogique;

//variable sensor garam
int sensorValue; //adc value
float outputValueConductivity; //conductivity value
float outputValueTDS; //TDS value


//-------------  FUZZY DAN SET NILAI TIAP VARIABEL -------------
#include <Fuzzy.h>
Fuzzy *fuzzy = new Fuzzy();
// FuzzyInput thermal
FuzzySet *dingin            = new FuzzySet(0, 9, 9, 18);
FuzzySet *normal            = new FuzzySet(18, 21, 21, 28);
FuzzySet *panas             = new FuzzySet(28, 39, 39, 50);

// FuzzyInput humid
FuzzySet *kering            = new FuzzySet(20, 40, 40, 60);
FuzzySet *lembab            = new FuzzySet(60, 75, 75, 89);
FuzzySet *basah             = new FuzzySet(89, 95, 95, 100);

// FuzzyInput rain sensor
FuzzySet *kena              = new FuzzySet(0, 0, 0, 0);
FuzzySet *tidak_kena        = new FuzzySet(1, 1, 1, 1);

// FuzzyOutput turn on off pump
FuzzySet *hidup               = new FuzzySet(1, 1, 1, 1);
FuzzySet *mati                = new FuzzySet(0, 0, 0, 0);

//-------------  PANGGIL TAB LAIN -------------
#include "2_fuzzy_set.h"
#include "3_fuzzy_rule.h"



//------------------------------------------------------------
//                        VOID SETUP
//------------------------------------------------------------

void setup()
{

  // Set the Serial output
  Serial.begin(9600);
//  lcd.begin();
  dht.begin();
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(capteur_D, INPUT);
  // Set a random seed
  randomSeed(analogRead(0));

  //---------  PANGGIL FUNGSI / FUNCTION FUZY DI TAB 2 DAN 3 ---------
  fuzzySet ();
  fuzzyRule ();
}





//------------------------------------------------------------
//                        VOID LOOP
//------------------------------------------------------------

void loop()
{
   // Getting a random value
  float t = dht.readTemperature(); 
  float k = dht.readHumidity();
  //read the analog in value:
  sensorValue = analogRead(analogInPin);
//  int inputsuhu = random(15, 50);
  String katasuhu = "Suhu :";
  String stringsuhu = katasuhu+t;
//  int inputlembab = random(20, 70);
  String katalembab = "Kelembaban :";
  String stringlembab = katalembab+k;
  int inputkena = 1;


  //Mathematical Conversion from ADC to conductivity (uSiemens)
  //rumus berdasarkan datasheet
  outputValueConductivity = (0.2142*sensorValue)+494.93;
  
  //Mathematical Conversion from ADC to TDS (ppm)
  //rumus berdasarkan datasheet
  outputValueTDS = (0.3417*sensorValue)+281.08;
  //  Set the random value as an input
  fuzzy->setInput(1, t);
  fuzzy->setInput(2, k);
  fuzzy->setInput(3, inputkena);
  // Running the Fuzzification
  fuzzy->fuzzify();
  // Running the Defuzzification
  float output = fuzzy->defuzzify(1);
  // Printing something
//  lcd.setCursor(0,0);
//  lcd.print(stringsuhu);
//  lcd.setCursor(0,1);
//  lcd.print(stringlembab);
//  delay(1000);
//  lcd.clear();
//  lcd.setCursor(0,0);
//  lcd.print("Salinitas (ppt) :");
//  lcd.setCursor(0,1);
//  lcd.print(outputValueTDS);
//  delay(1000);
//  lcd.clear();
  Serial.println("\n\n\nEntrance: ");
  Serial.print("\t\t\tSuhu: ");
  Serial.println(t);
  Serial.print("\t\t\tKelembaban: ");
  Serial.println(k);
  Serial.print("\t\t\tDigital value sensor hujan= : ");
  Serial.println(inputkena);
//  print the results to the serial monitor:
  Serial.print("\t\t\tsensor ADC = ");
  Serial.println(sensorValue);
//  Serial.print("\t\t\tconductivity (uSiemens)= ");
//  Serial.println(outputValueConductivity);
  Serial.print("\t\t\tTDS(ppm)= ");
  Serial.println(outputValueTDS);
  // Printing something
  Serial.println("Result: ");
  Serial.print("\t\t\tPompa: ");
  Serial.println(output);
  if(output==1){
    digitalWrite(RELAY_PIN, HIGH);
  }
  else if(output==0)
  {  digitalWrite(RELAY_PIN, LOW);}
  // wait 12 seconds
  delay(2000);
}

Hey, did you check which HEX Adress your LCD display got?

what i mean is the 0x27, if you use I2C you can have more HEX adress if you connect the A0, A1 or A2 pins on your Display.

"//LiquidCrystal_I2C lcd(0x27, 16, 2); "

have a look here: Nr.06 - Zwei I²C Displays | Funduino - Kits und Anleitungen für Arduino
there you will find something about HEX adress.

hope i could help you.

I've checked it and the address is 0x27 so I think the problem is not from the address

okey. Maybe you have to start it othervise:
try this in void setup ->
lcd.init();
lcd.backlight();

still not working. btw the board is uno that I used

You may want to look at using the hd44780 library.
It also includes a diagnostic test sketch to test everytihng.
The i/o class you want it hd44780_I2Cexp.

Install it using the IDE library manager. Search for Extensible hd44780
After installing run the diagnostic sketch I2CexpDiag to test everything.
Once that works, you try any of the other examples.

To use it you will only have to change the header files you include and the lcd object declaration.
Then add a lcd.begin(cols, rows) to you setup.

--- bill

thanks for the advice bro, but my problem has been solved, I change the board to the Arduino mega and it happens miraculously. thanks for helping me.

Actually you didn't really resolve your problem, it just masked it since you gave up and changed your environment before you really figured what the problem was.

I could have been related to missing pullups on the i2c signals.
This is why using the hd44780 library and running the I2CexpDiag sketch is useful as it will test everything and report any issues it discovers.

--- bill