Getting the last line on Serial Monitor.

Good day!

I have an NRF24L01+ connected to the rx/tx of my arduino.
Can you help me on how can I just get the last printed line on the serial?

This is the output:

0;0;3;0;9;read: 2-2-0 s=1,c=1,t=2,pt=2,l=2:0
0;0;3;0;9;send: 0-0-2-2 s=1,c=1,t=2,pt=2,l=2,st=ok:0
2;1;1;0;2;0

This is what I have to get:

2;1;1;0;2;0

This is the code for getting after the new line:

#include <AltSoftSerial.h>

// AltSoftSerial always uses these pins:
// Board          Transmit  Receive   PWM Unusable
// -----          --------  -------   ------------
// Arduino Uno        9         8         10

AltSoftSerial altSerial;
char inData[20]; 
int index = 0;

void setup() {
  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor to open
  Serial.println("AltSoftSerial Test Begin");
  altSerial.begin(115200);
  altSerial.println("Hello World");
}

void loop() {
  char inChar;

  if (altSerial.available()) {
    inChar = altSerial.read();
    //Serial.print(inChar);
    
    if (inChar != '\n') {
      inData[index] = inChar;
      index++;
    }
    else {
      Serial.print("Data");
      Serial.println(inData);
    }
  }
}

Is there a way to ignore thefirst tw lines?

you should use 2 buffers, one that hold the previous line and one for the last. If an \n (return) comes in the last moves to the previous and a new last ls made

Is there a way to ignore thefirst tw lines?

If you know how many to ignore, yes. Just count them. When the count is not right, do not parse the data.

Look at the examples in serial input basics. The second example reads in all the data up an end-marker that you specify and then you can do what you want with it.

...R

Does the sending device send an end of packet marker at the end of the byte string being sent?