Join Serial Data Seperated by Newlines? I have two Arduinos connected through Bluetooth. One sends a string of data similar to 506:507:1\r\n. The data can vary similar to 0:1000:0\r\n. I already have functions to break that string down into three variables. I send it from one Arduino over Bluetooth and the second Arduino receives it through Serial. The only problem is that the second Arduino receives this:

5
0
6
:
5
0
7
:
1
"\n"


At the end it adds a space at the end ("\n") How can I parse this data back into a string similar to 506:507:1\r\n that can still vary in length?
Simply reverse the steps you took on the sending side.


Create a char array of sufficient size as well as an index variable to keep track of your position within the array. An Arduino String may be more convenient, though they can cause a lot of problems.
In a loop, use available() to wait for incoming chars and add them to the array you've created, using your index variable. 
Keep going in the loop, while checking for that unique character (\n, perhaps) that signals the end of a packet. Add this last byte to the array and then terminate the string with null or \0.


If you want to re-use the array for another packet, simply set the index variable to 0 and continue.