Go Down

Topic: Storing incoming data from serial port (Read 1 time) previous topic - next topic



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.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


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


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 = Serial.read();
   for (i=0; i<51; i++)

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


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

Go Up