Issue with serial to 20X4 LCD

Hi guys,
I am reading in serial data using a software serial port from another Arduino over Bluetooth.
I have a loop that reads in characters into an String called "inData", this prints just fine to the serial monitor whilst it being read in but im trying to use the substring function to print data to the 20X4 lcd, but it doesn't seem to work.

I was having issues before with the serial data becoming corrupted or skipping characters when I was also trying to write to the 20x4.

I've included my receiver code, any ideas or modifications?

void loop() {
  while(RFSerial.available() > 0)  //was while
    {
        char recieved = RFSerial.read();
        inData += recieved; 
     
Serial.print(inData);

lcd.print(inData.substring(2,10));
inData="";

        }
}

cfcorp:
Hi guys,
I am reading in serial data using a software serial port from another Arduino over Bluetooth.
I have a loop that reads in characters into an String called "inData", this prints just fine to the serial monitor whilst it being read in but im trying to use the substring function to print data to the 20X4 lcd, but it doesn't seem to work.

I was having issues before with the serial data becoming corrupted or skipping characters when I was also trying to write to the 20x4.

I've included my receiver code, any ideas or modifications?

void loop() {

while(RFSerial.available() > 0)  //was while
    {
        char recieved = RFSerial.read();
        inData += recieved;
   
Serial.print(inData);

lcd.print(inData.substring(2,10));
inData="";

}
}

would you post all the code so we have it in context.

#include <Wire.h> 
#include <SoftwareSerial.h>
const int BAUD = 38400;
SoftwareSerial SoftSerial(8, 9);
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
String input;

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip
const int LCD_COLS = 20;
const int LCD_ROWS = 4;
void setup() {
  SoftSerial.begin(9600);//Set up IO
    Serial.begin(9600);

    int status;
  status = lcd.begin(LCD_COLS, LCD_ROWS);
  if(status) // non zero status means it was unsuccesful
  {
    status = -status; // convert negative status value to positive number
     hd44780::fatalError(status); // does not return
  }
    lcd.backlight();
  lcd.clear();
  lcd.setCursor(0,1);
}

void loop() {
  while(SoftSerial.available() > 0)  //was while
    {
        char recieved = SoftSerial.read();
        input += recieved; 
     
Serial.print(input);

lcd.print(input.substring(2,10));
input="";
}
}

ok yeah I suppose the input=""; would clear the string everytime, it iterates through a character being read. Hmm i missed that, DUH

Although, just tested the above and it doesn't work. If i do the scan out side the loop it will mess up the received data, i think it messes with the timing of the received data and the Arduino misses some of the data at the serial port and prints it incorrectly.