I am posting two sketches below by virtue of which two UNOs exchange data over software serial port (SUART Port). The UNO-1 is sending the float type temperature data with 0x05 as a terminating byte. The UNO-2 receives the data and saves in an array. You may practice these setup as a tutorial and then apply the methodology to achieve your objectives.
Transmission Codes
//sender_ code
#include<SoftwareSerial.h>
SoftwareSerial mySUART(2, 3); //SRX, STX
int pin = 0;
int data;
char dataBuffer[20] = "";
void setup()
{
Serial.begin(9600);
mySUART.begin(9600);
analogReference(INTERNAL);
}
void loop()
{
float tempC = (float)100 * (1.1 / 1024.0) * analogRead(A0); //
Serial.print("Pressure data = ");//
Serial.println(tempC, 2);
mySUART.print(tempC); //sends 8-bit ASCII code for each digit/symbol of tempC
mySUART.write(0x05);
delay(1000);
}
Reception Codes
//sender_ code
#include<SoftwareSerial.h>
SoftwareSerial mySUART(2, 3); //SRX, STX
int data;
char dataBuffer[20] = "";
int i = 0;
void setup()
{
Serial.begin(9600);
mySUART.begin(9600);
}
void loop()
{
if (mySUART.available() > 0)
{
byte x = mySUART.read();
if (x == 0x05)
{
Serial.println(": This data is from SUART Port");
Serial.println();
Serial.print("Pressure data from Buffer = ");
Serial.println(dataBuffer);
Serial.println("====================");
i = 0;
}
else
{
dataBuffer[i] = x;
Serial.write((char)dataBuffer[i]);
i++;
}
}
}