Collecting data from 3 serial ports on Arduino Mega

I'm attempting to have my Arduino Mega take in 3 different strings of data through Serial 1,2,3 respectfully. I want my Arduino to collect these 3 strings and then push them out of the 4th Serial port (the embedded one). Here are is my setup essentially.

UART 0 - HC-05 (master mode, receives data from another HC-05 on a separate MC)
UART 1 - LRF (the rangefinder reads in a value for distance and communicates through serial)
UART 2 - Gyroscope (the angle of pitch is read through through this serial terminal)
UART 3 - HC-05 (slave mode, sends the collective data from all 3 serial ports to an android app)

I'm able to test each component individually as I connect them to the UART 0 and check them with the USB connection to my computer. I'm wondering what I need to do to compile all of the data into essentially one packet to send to the android application.

I'm using EasyTransfer for the initial HC-05 and am hoping it's possible to use it again once I have all of the data read in and stored properly.

I am not sure I understand the question.
Create a char array big enough to hold the information you require.

Use strcat( ) to append.

.

I've got 3 different serial connections currently.

1 - HC-05 receiving data sent from a separate Arduino over Bluetooth.
2 - RS400 (RS 400 Rangefinder - Opti-Logic Corporation) outputting the range when requested
3 - Jy901 Gyroscope (receiving the angle I am holding my device at)
4 - HC-05 sending the collective data from the three other serial ports to an android app via Bluetooth.

If I need to create an array big enough to hold the info can you give me some steps how to do that? Would I simply have each serial port individually write to that array, and if so how? Basically I am lost at how to find a way to collect all the data being sent to my arduino via the serial ports.

I've got each device waiting to collect data for a button press, therefore mitigating the issue of an overflow as data isn't just constantly streaming in.

It sounds like you don't know how to program at all.

What are you doing now in terms of your sketch to make all of this work?

.

That’s why I’m here…

I’ve attached one variation of my code that reads in two serial devices.

Senior_Design_Sketch_V7_Master.ino (1.99 KB)

arduino_student_17:
I'm able to test each component individually as I connect them to the UART 0 and check them with the USB connection to my computer. I'm wondering what I need to do to compile all of the data into essentially one packet to send to the android application.

Essentially, nothing. As I understand it, you are already sending the data you need to the serial monitor. In short, you know what you are doing and everything is ticketypoo, except that you just need to realise that bluetooth is a lot simpler than you think it is. You already have serial output using cable and bluetooth is the same serial output not using cable. Arduino neither knows nor cares which way you do it, it just talks to the port. All you need do is connect HC-05 to serial pins 0,1, and away you go, sending the same data to Android. The most you should need to do is maybe format the data in a manner more suitable for the Android Terminal, e.g. superfluous stuff that wastes screen space.

Overflow has nothing to do with it, you can just Serial.print the stuff out as it arrives. I'm not even sure you need a button. Won't polling each device in the loop suffice?

arduino_student_17:
I’ve attached one variation of my code

Please read the stickies at the head of this forum, and post your code in the proper manner, using code tags </>