sending constant temp reading from sensor to lCD

I have the LCD set and I am able to gain a reading from sensor using the serial monitor after hitting r

Im trying to send a constant temp reading to the LCD

thank you

//Base code from Atlas i2c example available here: https://www.atlas-scientific.com/_files/code/ph-i2c.pdf
//rewritten by Carl Recktenwald Jr. Recks Design and Fabrication
//for use with the WhiteBox Labs Tentacle shield https://www.whiteboxes.ch/tentacle/
//and the Atlas EZO PH Stamp connected via i2c

//**THIS CODE WILL WORK ON ANY ARDUINO**
//This code has intentionally has been written to be overly lengthy and includes unnecessary steps.
//Many parts of this code can be truncated. This code was written to be easy to understand.
//Code efficiency was not considered. Modify this code as you see fit.
//This code will output data to the Arduino serial monitor. Type commands into the Arduino serial monitor to control the EZO pH Circuit in I2C mode.


#include <Wire.h>                //enable I2C.
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define address 99              //default I2C ID number for EZO pH Circuit.
#define I2C_0x27                //LCD address
#define address 102              //default I2C ID number for EZO RTD Circuit.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
//LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, BACKLIGHT_PIN, POSITIVE); // Set the LCD I2C address


char computerdata[20];           //we make a 20 byte character array to hold incoming data from a pc/mac/other.
byte received_from_computer = 0; //we need to know how many characters have been received.
byte serial_event = 0;           //a flag to signal when data has been received from the pc/mac/other.
byte code = 0;                   //used to hold the I2C response code.
char ph_data[20];                //we make a 20 byte character array to hold incoming data from the pH circuit.
byte in_char = 0;                //used as a 1 byte buffer to store in bound bytes from the pH Circuit.
byte i = 0;                      //counter used for ph_data array.
int time_ = 600;                 //used to change the delay needed depending on the command sent to the EZO Class pH Circuit.
float ph_float;                  //float var used to hold the float value of the pH.
                                  // copied from Atlas temp sheet
char RTD_data[20];               //we make a 20 byte character array to hold incoming data from the RTD circuit. int time_=600;                   //used to change the delay needed depending on the command sent to the EZO Class RTD Circuit. 
float tmp_float;                 //float var used to hold the float value of the RTD.

void setup() {
  Wire.begin();                 //enable I2C port.
  
  // set the LCD type
  lcd.begin(20, 4);            // initialize the lcd
  lcd.setBacklight(HIGH);


  lcd.setCursor(3, 0);
  lcd.print("Genovese Shield  ");
  lcd.setCursor(0, 1);
  lcd.print("Temp:");
   lcd.setCursor(0, 2);
  lcd.print("PH:");
     lcd.setCursor(9, 2);
  lcd.print("ORP:");
   lcd.setCursor(0, 3);
  lcd.print("Salinity:");
  

}

void loop() { //the main loop.

  if (serial_event) {          //if the serial_event=1.
    if (computerdata[0] == 'c' || computerdata[0] == 'r')time_ = 1800; //if a command has been sent to calibrate or take a reading we wait 1800ms so that the circuit has time to take the reading.
    else time_ = 300;       //if any other command has been sent we wait only 300ms.


    Wire.beginTransmission(99); //call the circuit by its ID number.
    Wire.write(computerdata);        //transmit the command that was sent through the serial port.
    Wire.endTransmission();          //end the I2C data transmission.


    delay(time_);                    //wait the correct amount of time for the circuit to complete its instruction.

    Wire.requestFrom(99, 20, 1); //call the circuit and request 20 bytes (this may be more than we need)
    code = Wire.read();             //the first byte is the response code, we read this separately.

    while (Wire.available()) {        //are there bytes to receive.
      in_char = Wire.read();           //receive a byte.
      ph_data[i] = in_char;            //load this byte into our array.
      i += 1;                          //incur the counter for the array element.
      if (in_char == 0) {             //if we see that we have been sent a null command.
        i = 0;                      //reset the counter i to 0.
        Wire.endTransmission();     //end the I2C data transmission.
        break;                      //exit the while loop.
        
        //Print the PH to the LCD screen
        lcd.setCursor(2, 0);
        lcd.print("PH:");
        lcd.setCursor(2, 3);
        lcd.print(ph_data);

        //take the pH value and convert it into floating point number so ph reads 7.00 instead of 7.000
        ph_float = atof(ph_data);
        lcd.setCursor(0, 2);
        lcd.print("PH:");
        lcd.setCursor(3, 2);
        lcd.print(ph_float);

        //Wait 5 sec before asking for the PH again
        delay(5000); {              


          // Temp reading 
            while(Wire.available()){          //are there bytes to receive.  
   in_char = Wire.read();           //receive a byte.
   RTD_data[i]= in_char;            //load this byte into our array.
   i+=1;                            //incur the counter for the array element. 
    if(in_char==0){                 //if we see that we have been sent a null command. 
        i=0;                        //reset the counter i to 0.
        Wire.endTransmission();     //end the I2C data transmission.
        break;                      //exit the while loop.
        
        //Print the Temp to the LCD screen
        lcd.setCursor(0, 1);
        lcd.print("Temp:");
        lcd.setCursor(5, 1);
        lcd.print(RTD_data);

        //take the temp value and convert it into floating point number so ph reads 7.00 instead of 7.000
        ph_float = atof(ph_data);
        lcd.setCursor(0, 1);

        lcd.print("Temp:");
        lcd.setCursor(5, 1);
        lcd.print(tmp_float);

        //Wait before asking for the Temp again
        delay(5000); { // reset set in 5 sec
       
    }
  }
        }
        }
      }
    }
  }}

ageno125:
I have the LCD set and I am able to gain a reading from sensor using the serial monitor after hitting r

Im trying to send a constant temp reading to the LCD

...and?

First, tell us what you expect to see on the LCD display and what you are actually seeing. If the sensor sends you a number, what's shown on the display. Sample input and the resultant output is really helpful.

Second, move the cursor into the source code window of the IDE and press Ctrl-T, which will reformat your code into a more easily read format.

Third, most C programmers would write:

i+=1;

as

i++;

The effect is the same.

byte in_char = 0;                //used as a 1 byte buffer to store in bound bytes from the pH Circuit.

Absolute rubbish. Do NOT use a type in a name when the type used in the name is NOT the type of the variable being named.

  if (serial_event) {          //if the serial_event=1.

That is NOT what the code does. If that is what the code SHOULD do, write the code to do JUST that.

Have you tried any simple test with this LCD, for e.g print 'Hello world'. If not just try to do that, after that you can venture into more complex scenario of reading temperature or pH and displaying it.