Faster Serial Communication

Hi, i am trying to use my Pybadge as a Controller for my Unity Project, the Problem is, that sending Text to the Pybadge needs around 0,5 sek. I raised the baudrate but that didnt change anything, is there something else i can do? Do i need to use Flush, or do Something with Threads. Or should i use a buffer or send other formats of Date?
This is the Method on Arduino: it is called at the beginning of the Loop

void read(){
  while(Serial.available() > 0){
    String msg = Serial.readString();
    msg = "";
  }
}

In the Setup Method i use Serial.begin(115200);

From my Computer, i send Data using C# With Serial.Write("String");
I am new to this stuff and would appreciate some help

Most probably the system loops in Seral.readString(). Use C strings char[] instead of String and read byte by byte as one becomes available.

That's bogus, isn't it?
Is the transmitted data terminated as readString() expects?

Thanks for the Response, i used the recived Data, but for testing i dont use it right now, just reciving The String "#4" Stops the Pybadge from sending anything for 0,5 sek

Looks like a fixed timeout on a missing terminator. Which terminator is your readString expecting? Did you send it?

1 Like

Oh, i need a Terminator at the End of my String, That would explain it. I will try that now, thanks for your help

It worked, Love you

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.