Serial Communication with Serial Printer

good day, i'm trying to gather the data sent by a telemetry equipment to our company's Serial Printer (with baudrate of 1200, even parity, 1 stop bit) to my arduino mega., I manage to gather the data but i can't make it look similar to what the Serial Printer prints.
can someone help me with my project? i attach my code and the result i gathered

String Printer = "";

void setup() {

  Serial.begin(1200, SERIAL_8E1);
  Serial1.begin(1200, SERIAL_8E1);

}

void loop() {

  if (Serial1.available() > 0) {
    while (Serial1.available()) {
      char Telemetry = Serial1.read();
      Printer += Telemetry;
      delay(5);
    }
    Serial.println(Printer);
  }
}

the last line in what i gathered is what our Serial Printer prints, how can i remove the 1st-19th line so that i can manage to save what i gathered to .csv file that looks like what our Serial Printer prints, thanks

good day, i'm trying to gather the data sent by a telemetry equipment to our company's Serial Printer (with baudrate of 1200, even parity, 1 stop bit) to my arduino mega., I manage to gather the data but i can't make it look similar to what the Serial Printer prints. The Serial Printer prints something like this :

@ p0 M r0 r0 r0 09:00 r0 900++ r0 168++ r0 499++ r0 233++ r0 *** .....

but the data i gathered looks like this:

@
@ p
@ p0
@ p0
@ p0 M
@ p0 M
@ p0 M r
@ p0 M r0 .....

then finally at 19th line, it will look like what Serial Printer prints:

@ p0 M r0 r0 r0 09:00 r0 900++ r0 168++ r0 499++ r0 233++ r0 *** .....

how can i remove the 1st line to 18th line so that the data i gathered will be similar to what our Serial Printer prints

btw this is my code in this project,

String Printer = "";

void setup() {

  Serial.begin(1200, SERIAL_8E1);
  Serial1.begin(1200, SERIAL_8E1);

}

void loop() {

  if (Serial1.available() > 0) {
    while (Serial1.available()) {
      char Telemetry = Serial1.read();
      Printer += Telemetry;
      delay(5);
    }
    Serial.println(Printer);
  }
}

thanks in advance
-daniel

good day, i'm trying to gather the data sent by a telemetry equipment to our company's Serial Printer (with baudrate of 1200, even parity, 1 stop bit) to my arduino mega., I manage to gather the data but i can't make it look similar to what the Serial Printer prints. The Serial Printer prints something like this :

@ p0 M r0 r0 r0 09:00 r0 900++ r0 168++ r0 499++ r0 233++ r0 *** .....

but the data i gathered looks like this:

@
@ p
@ p0
@ p0
@ p0 M
@ p0 M
@ p0 M r
@ p0 M r0 .....

then finally at 19th line, it will look like what Serial Printer prints:

@ p0 M r0 r0 r0 09:00 r0 900++ r0 168++ r0 499++ r0 233++ r0 *** .....

how can i remove the 1st line to 18th line so that the data i gathered will be similar to what our Serial Printer prints

btw this is my code in this project,

String Printer = "";

void setup() {

  Serial.begin(1200, SERIAL_8E1);
  Serial1.begin(1200, SERIAL_8E1);

}

void loop() {

  if (Serial1.available() > 0) {
    while (Serial1.available()) {
      char Telemetry = Serial1.read();
      Printer += Telemetry;
      delay(5);
    }
    Serial.println(Printer);
  }
}

thanks in advance
-daniel

Just don't build up the String, print character as they come

Printer += Telemetry; adds the new character to the Printer String and it will grow like crazy for every line... (using the String class is also a bad idea)

DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=496385
I HAVE REPORTED THIS THREAD TO THE MODERATORS

DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=496385
I HAVE REPORTED THIS THREAD TO THE MODERATORS

thanks dude, so do you have any suggestion what can i replace with string?
based on what you just said, i will try something like this..

  if (Serial1.available() > 0) {
    while (Serial1.available()) {
      char Telemetry = Serial1.read();
      Printer += Telemetry;
      delay(5);
      Serial.print(Printer);
      Printer ="";
    }

 }

thanks dude :slight_smile:

:o

pert:
DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
[MERGED] Serial Communication - Programming Questions - Arduino Forum
I HAVE REPORTED THIS THREAD TO THE MODERATORS

why are you upset? im just trying to solve my problem in this project, if you cant help just shut up,

daniel_levi_16:
why are you upset?

Cross-posting wastes your time, my time, and the time of every person trying to help you. In other words, you cross-posting makes you a selfish oik.

im just trying to solve my problem in this project

So are all the people who have voluntarily contributed unbelievable man-hours on this forum.

if you cant help just shut up

If you can't behave in a civil manner go away.

Threads merged.

void loop()
{
  if(Serial1.available() > 0)
  {
    Serial.print(Serial1.read());
  }
}

Now, if you also want to do other stuff, you might want to collect the data; see Robin2's Serial input basics - updated thread for ideas to get rid of the String (capital S) class.