Mbed LPC1768 Serialcommunication with NodeMcu

Hey,

I got a problem with the Serialcommunication between mbed and the nodemcu.
The wiring is: Nodemcu rx to mbed tx.

 #include "mbed.h"
Serial nodemcu(p28, NC);
int main()
{
    nodemcu.baud(115200);
while(1) {
        t2.start();
        if(t2.read_ms() > 1000)
        {
        nodemcu.printf("Hello");
        t2.reset();
        }
 }
}

My problem is if there is no delay about 1second after nodemcu.printf I dont recieve anything on the Nodemcu.

NodeMcu:

void setup() {
  Serial.begin(115200);
  Serial.println("Starting...");
}
void loop() {
  while (Serial.available()) {
    String node = "";
    node = Serial.readString();// read the incoming data as string
    Serial.println(node);
 }
}

Hello Dustin,

You can try to force a write of all buffered data. Maybe it helps:

...
nodemcu.printf("Hello");
fflush(nodemcu);  // force to send buffered data
...

Thanks for your help.

I resolved the issue. The problem was that the read.String on the Nodemcu takes a long time.