Go Down

Topic: ESP8266 receive serial data and transmit on UDP (Read 299 times) previous topic - next topic

sayra_nandhan

Hello,

I want to read the incoming string from the microcontroller and transmit the same in UDP. The UDP data gets transmitted bit by bit and not as a whole. Please guide me through this. My code is as below,




  while (Serial.available())
  {

    char inChar = (char)Serial.read();
    inputString += inChar;


    Serial.printf("%c", inChar);
    Udp.endPacket();
    Udp.beginPacket(IP, 7727);
    Udp.write(inChar);
    Udp.endPacket();


  }

rw950431

Welcome to the forum!

What is the problem you are having?  How does this small piece of code fit in your complete program?

(And please use the code tags </> to nicely format your code..)



PaulS

Quote
The UDP data gets transmitted bit by bit and not as a whole.
You wrote the program that way, so I'm not surprised.

You need to define what "a whole" means. Serial data is just a bunch of bytes. You have to collect the bits and pieces until you have what you consider "a whole", and then send that.
The art of getting good answers lies in asking good questions.

Go Up