How to sending data from arduino and from nodemcu esp8266

Hai all, i have problem with my program, i don't know how to send data from my nodemcu. i have managed to send data from arduino uno to nodemcu using serial communication but i have an ultrasonic sensor connected to nodemcu, i want it when i open the serial monitor my sensor on nodemcu and arduino is running. I've done many things but still fail

#define triggerPin1  D8
#define echoPin1     D6
#define triggerPin2  D8
#define echoPin2     D7


int led1= D1;
int ledr1= D2;
int led2= D3;
int ledr2= D4;

// millis sebagai ganti delay
unsigned long previousMillis = 0;
const long interval = 3000;
//variable array untuk data parsing
String arrData[4];
void setup() {
  Serial.begin (9600);
  pinMode(triggerPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  pinMode(triggerPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(ledr1, OUTPUT);
  pinMode(ledr2, OUTPUT);
}
void loop() {
  long duration1, jarak1;
  digitalWrite(triggerPin1, LOW);
  delayMicroseconds(2); 
  digitalWrite(triggerPin1, HIGH);
  delayMicroseconds(10); 
  digitalWrite(triggerPin1, LOW);
  duration1 = pulseIn(echoPin1, HIGH);
  jarak1 = (duration1/2) / 29.1;

  Serial.print("Sensor1 :");
  Serial.print(jarak1);
  Serial.println("cm");

  if (jarak1 <= 15) {
    digitalWrite(led1, LOW);
    digitalWrite(ledr1, HIGH);
  } else{
  digitalWrite(led1, HIGH);
  digitalWrite(ledr1, LOW);
  }
  delay(1000);
  
  
  //Sensor2
  long duration2, jarak2;
  digitalWrite(triggerPin2, LOW);
  delayMicroseconds(2); 
  digitalWrite(triggerPin2, HIGH);
  delayMicroseconds(10); 
  digitalWrite(triggerPin2, LOW);
  duration2 = pulseIn(echoPin2, HIGH);
  jarak2 = (duration2/2) / 29.1;

  Serial.print("Sensor2 :");
  Serial.print(jarak2);
  Serial.println("cm");

  if (jarak2 <= 15) {
    digitalWrite(led2, LOW);
    digitalWrite(ledr2, HIGH);
  } else{
  digitalWrite(led2, HIGH);
  digitalWrite(ledr2, LOW);
  }
  delay(1000);
  // konfigurasi millis
  unsigned long currentMillis = millis(); // baca waktu millis saat ini
  if(currentMillis - previousMillis >= interval){
    //update privousMillis
    previousMillis = currentMillis;
    //baca data dari arduino uno
    // baca data serial
    String data ="";
    while(Serial.available()>0){
      data += char(Serial.read());
    }
    //hapus spasi data
    data.trim();
    if(data !=""){
      //parsing data
      int index = 0;
      for(int i=0; i<= data.length(); i++){
        char delimiter = '#';
        if(data[i] != delimiter)
          arrData[index] += data[i];
        else
          index++;
      }
      //pastikan data yang dikirim lengkap
      if(index == 1){
        //tampilkan nilai sensor
        Serial.println("Sensor3 :" + arrData[0] + "cm");
        Serial.println("Sensor4 :" + arrData[1] + "cm");
        Serial.println();
      }
      arrData[0] = "";
      arrData[1] = "";
    }
    //minta data ke arduino uno
    Serial.println("Ya");
    
  
  }
  
}



Shouldn't this:

for(int i=0; i<= data.length(); i++){

be this?

for(int i=0; i< data.length(); i++){

Can you please provide a wiring diagram?

Do you want that the NodeMCU will acquire data from its ultrasonic sensors and then send them to UNO using UART Port?

I just want the NodeMCU to get data from its ultrasonic sensor because the Arduino Uno has an ultrasonic sensor and I have successfully sent data from the Arduino Uno to the NodeMCU, on the other hand, my NodeMCU also has an ultrasonic sensor. so i want when i run program on nodemcu, i get data from nodemcu and data sent form arduino uno

1. Are you using the following type of sensor (Fig-1)? If so, check that it is 3.3V (Vcc) sensor to work with NodeMCU. There are 3.3V and 5V versions of ultrasonic sensors.
ultrasonicSensor
Figure-1:

2. Connect NodeMCU and UNO as per following diagram (Fig-2) using UART Port.

uartNodeUnoUltrasonic
Figure-2:

3. Upload following sketch in NodeMCU (compiled but not tested).

#include<SoftwareSerial.h>
SoftwareSerial SUART(D2, D1);//SRX = D2-pin, STX = D1-pin

#define triggerPin1  D8
#define echoPin1     D6

void setup() 
{
  Serial.begin (9600);
  SUART.begin(9600);
  pinMode(triggerPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
 }

void loop() 
{
  long duration1, jarak1;
  digitalWrite(triggerPin1, LOW);
  delayMicroseconds(2);
  digitalWrite(triggerPin1, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin1, LOW);
  duration1 = pulseIn(echoPin1, HIGH);
  jarak1 = (duration1 / 2) / 29.1;
  //-------------------------------
  Serial.print("Sensor1 :");
  Serial.print(jarak1);
  Serial.println("cm");
  //--------------------------------
  SUART.print(jarak1);   //send ASCII codes of jarak1 to UNO
  delay(2000);   //test interval
}

4. Upload following sketch in UNO (compiled but not tested).

#include<SoftwareSerial.h>
SoftwareSerial SUART(2, 3);//SRX = DPin-2, STX = DPin-3

void setup()
{
  Serial.begin (9600);
  SUART.begin(9600);
}

void loop()
{
  byte n = SUART.available();
  if(n !=0 )
  {
    char x = SUART.read();
    Serial.print(x);
  }
}

5. Check that SM1 (Serial Monitor 1) of UNO shows data being sent by NodeMCU.

Your description makes me dizzy. Draw a picture.