DATA LOGGER Wıth multiple Slave

I have 2 slaves and 1 master, my data stream is regular, but I try to save it in two different text documents in order, but I cannot save it.

2 arduino mega2560 (slaves)
first slave send to tempreture
second slave send to Co infos.

1 arduino mega2560(master)

and 3 TTL RS485(2 for slaves 1 for master)

//rs485
int enablePin = 8;

//rs485 slave
int enableKarbon = 2;
int enableTermo = 3;

const byte numChars = 255 ;
char receivedChars[numChars];

volatile static byte ndx = 0;
volatile char endMarker = ‘\n’;
volatile char rc;

void setup() {

Serial1.begin(9600); //seri port 1 başlatıldı
Serial.begin(9600); //seri port başlatıldı

//pin atamaları
pinMode(enablePin, OUTPUT);
pinMode(enableKarbon, OUTPUT);
pinMode(enableTermo, OUTPUT);

//low → receiver , high-> transmitter
digitalWrite(enableKarbon, LOW);
digitalWrite(enableTermo, LOW);
digitalWrite(enablePin, LOW);

//interruptların ayarlanması
attachInterrupt(digitalPinToInterrupt(enableKarbon), veri_oku , HIGH);
attachInterrupt(digitalPinToInterrupt(enableTermo), veri_oku , HIGH);

//delay(1000);

}

void loop() {
receivedChars[255]="";

sei();
//karbon_slave ile veri iletişimi
digitalWrite(enableKarbon, HIGH);
delay(1000);
digitalWrite(enableKarbon, LOW);
cli();

millis();

Serial.println(" ");

receivedChars[255]="";

sei();

//termo_slave ile veri iletişimi
digitalWrite(enableTermo, HIGH);
delay(1000);
digitalWrite(enableTermo, LOW);
cli();

millis();

Serial.println(" ");

}

void veri_oku() {

while (Serial1.available() > 0) {
rc = Serial1.read();
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;

}

else {
receivedChars[ndx] = ‘\0’;
ndx = 0;

}
}
Serial.print(receivedChars);
cli();
}
millis(); //

}

this is the code i dont know how can save in memory card i want to save 2 different txt’s coming from data.

Hello and welcome to the forum!

As it is your first post, I would kindly recommend that you learn how to use the forum and paste your code in code tags ( </> ). Thanks!