Storing incoming data from serial port


I have some data coming in from the serial port and i want to manipulate the data further only i have no idea how to store/save the incoming data so i can further use it in the program.

Any suggestions would be highly appreciated. Thanks in advance

It depends on how large a chunk of data you are manipulating.

If you are changing each character individually, don't store the data.

If you have a little data, say a line of characters at a time, store it in an array (SRAM), manipulate that line, and send it out.

If you have a LOT of data, say several thousand characters, you can store them on an SD card (you will need to add hardware). Then you can read and write the SD card.

For some reason when i try to store the data in an array, lots of spaces get included. Can u tell me what i’m doing wrong??
I’m attaching the code i’m using before and after.

Any help would be great.
Thanks in advance

after.txt (633 Bytes)

before.txt (493 Bytes)

These only look to see if you have more than 0 bytes (i.e. 1), but then write out 51 bytes.
Change the code to only write a byte into array when one has come in, increment a counter to stop writing data in when 50 bytes have been received.

if (mySerial.available())

if (Serial.available()>0)
for (i=0; i<51; i++)
outputs =;

  • }*

  • for (i=0; i<51; i++)*
    _ Serial.println(outputs*);_

Oh ya!! LOL!! Thankyou so much!!!! :) :)