Serial communication btween arduino Uno & Nodemcu

I would like to communicate Serially with arduino uno & Nodemcu unit.

Here is thing what i am looking for. Nodemcu will send request in hex 01 03 006B 0003 7687 as character & arduino should match hex string and reply Serial String.

Below code is serial communication example.

Arduino code

#include <dht.h>
dht DHT;
int temp,humi;
#define DHT11_PIN A0
String str;
void setup(){
 Serial.begin(115200);
 Serial1.begin(115200);
 Serial.print(char(169)); // Copyright Symbol
 Serial.println(" Myengineeringstuffs.com");
 delay(2000);
}
void loop()
{
  DHT.read11(DHT11_PIN);
  humi=DHT.humidity;
  temp=DHT.temperature;
  Serial.print("H: ");
  Serial.print(humi); 
  Serial.print("% ");
  Serial.print(" T: ");
  Serial.print(temp); 
  Serial.print(char(176));
  Serial.println("C");
  str =String('H')+String(humi)+String('T')+String(temp);
  Serial1.println(str);
  delay(5000);
}

nodemcu code

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() { // run over and over
  if (Serial.available()) {
    Serial.write(Serial.read());
  }
}

you can test both with Serial Monitor

I have tested this code . I found node mcu reset . Previous code works well
But i would like to send request in hex if datais valid response ok else not ok

Ard_code

int val = 0;
int incoming = 0;
int incoming1 = 0;

void setup()
{
  Serial.begin(115200);  //Begin Serial to talk to the Serial Monitor   

  Serial.println("Serial Monitor Connected"); 
  Serial.parseInt();     //clear any garbage in the buffer.  
}

void loop()
{


  //     From the Rx Arduino
  incoming1 = Serial.available();  
  while(incoming1 != 0)           //While there is something to be read
  {
    val = Serial.parseInt();    //Get new value
    Serial.print("Receiving...  ");    
    Serial.println(val);        //Print new value to the Serial Monitor
    incoming1 = Serial.available();
  }
}

NodeMCu_code

int val = 0;
int incoming = 0;
unsigned int i;
byte Send_buf[] = {0x01,0x03,0x00,0x00,0x00,0x0a,0xFD};




void setup()
{
  Serial.begin(115200);

}

void loop()
{
  incoming = Serial.available();
  while (incoming != 0)                 //While there is something to be read
  {
  Serial.write(Send_buf[0]);
   
  }
 
  
  //delay(200);
}

i Have tested simple code on both device

If i connect USB to Serial converter and send any data with below code it will be reflected arduino comport. if i connect both device serially it wont connect. Arduino uno only print "started" from Node MCU.

From docklight i m sending welcome for every 5sec . I dont know why its not printing

Nodemcu code

#include "SoftwareSerial.h"

const byte rxPin = 13;
const byte txPin = 15;

SoftwareSerial mySerial (rxPin, txPin); 

void setup() 
{
  mySerial.begin(115200);
  Serial.begin(115200);
  Serial.print("Started");
}

void loop() 
{
  if(mySerial.available())
  {
    String incomingMessage = mySerial.readString();
    Serial.println(incomingMessage);
  }
}

Arduino code

#include "SoftwareSerial.h"

const byte rxPin = 2;
const byte txPin = 3;

SoftwareSerial mySerial (rxPin, txPin); 

void setup() 
{
  mySerial.begin(115200);
  Serial.begin(115200);
  Serial.print("Started");
}

void loop() 
{
  if(mySerial.available())
  {
    String incomingMessage = mySerial.readString();
    Serial.println(incomingMessage);
  }
}

you can't use SoftwareSerial at 115200. 19200 baud max

I have done Below modification

arduino code

#include "SoftwareSerial.h"

const byte rxPin = 2;
const byte txPin = 3;

SoftwareSerial mySerial (rxPin, txPin); 

void setup() 
{
 // mySerial.begin(115200);
  Serial.begin(115200);
 // Serial.print("Started");
}

void loop() 
{
  if(Serial.available())
  {
    String incomingMessage = Serial.readString();
    Serial.println(incomingMessage);
  }
}

Nodemcu code

void setup() 
{
 // mySerial.begin(115200);
  Serial.begin(115200);
 // Serial.print("Started");
}

void loop() 
{
  if(Serial.available())
  {
    String incomingMessage = Serial.readString();
    Serial.println(incomingMessage);
  }
}

If i send any data from nodemcu it will be printed Arduino comport. If i send any string from arduino port it wont be printed. Let me check Softwareserial baudrate to 9600

My question is nodemcu baudrate is 115200 . weather it communicate if baudrate fixed to 9600. Software serial function not worked in nodemcu so i used Actual TX and Rx lines

do not use USB of the NodeMcu, if you connected Serial RX/TX of esp8266 to Arduino. the reasin is same as in the Uno. it is the same interface the USB and the RX/TX pins

I have change baudarte 9600 . Individually checked Software serial library with USB to ttl converter . Its working fine. When i paste same code in Individual Model & tx_Ard to rx_Node & Tx_node to Rx_ard

It wont reply . For nodeMcu if i directly use Serial communication it only read the data from Arduino But it wont reply for nodemcu

I have tested code with arduino Uno and Docklight for communication . Independently Software Serial works fine on Both Boards. Problem caused when same code used on both ic with relevant PIn config

I have attached my response in previous thread,

#include "SoftwareSerial.h"

const byte rxPin = 2;
const byte txPin = 3;

SoftwareSerial mySerial (rxPin, txPin); 

void setup() 
{
 // mySerial.begin(115200);
  Serial.begin(115200);
 // Serial.print("Started");
}

void loop() 
{
  if(Serial.available())
  {
    String incomingMessage = Serial.readString();
    Serial.println(incomingMessage);
  }
}

Since there 2 serial port is avilable on nodemcu .. How can i use second one

If i use serial.print primary it work
if i use SoftwareSerial secondary will work

but nodemcu say 2 hardware serial like arduino mega how can i use it

void setup() 
{

  
  Serial1.begin(115200);
  Serial1.print("Started");
}

void loop() 
{
  if( Serial.available())
  {
    String incomingMessage =  Serial.readString();
    Serial.println(incomingMessage);
  }

  Serial1.println("welcome");
  //delay(5000);
}

the Serial1 has only TX. io 2