Hello, I am trying to receive the data from my 2 transmitter and output it in the serial monitor at the same time. Basically what I am trying to do now is just reading both radios at the same time and printing the data in serial monitor. but this method do not seem to work and the data are getting mixed up upon printing the data from tx1 and tx2.
Both transmitters are sending the data in packets continuously
This is the sample code on how i print the data in my receiver:
if ( myRadio.available()) {
myRadio.read( &packet_tx1, sizeof(packet_tx1) );
myRadio.read( &packet_tx2, sizeof(packet_tx2) );
Serial.print("TX1");
Serial.print(", "); Serial.print(packet_tx1.data1);
Serial.print(", "); Serial.print(packet_tx1.data2);
...
Serial.println();
...
Serial.print("TX2");
Serial.print(", "); Serial.print(packet_tx2.data1);
Serial.print(", "); Serial.print(packet_tx2.data2);
Serial.print(", "); Serial.print(packet_tx2.data3);
...
...
...
Serial.println();
delay(1000);
}
I expected it to print the data in sequence what i am trying to do is printing the data from tx2 after the tx1 prints its data. but unfortunately it prints the data from transmitters randomly and in no order also there are times the data from tx1 and tx2 are getting mixed up.
It seems that the sending of the data are becoming interrupted due to the transmitters sending data
same time with no timing at all.
Is what i am trying to do possible ? What method can use to print the data simultaneously?
Hope anyone can help me with my problem.