I'm trying to detect baud rate of Arduino Mega2560 by using C#. My code is below:

SerialPort SP=new SerialPort();
SP.BaudRate = 115200;

BaudRate is specified as a constant like this, but I would like to automatically detect it.

For instance, if Arduino code includes Serial.begin(xxxx), program should declare SP.BaudRate = xxxx.

How can I do it?


I'm not a C# programmer but this StackOverflow answer might be what you're looking for.

  • Note that to do this, there has to be a way to get an expected response from the device. – Chris Stratton Oct 27 '14 at 16:27
  • True, but you'll probably want some sort of basic handshaking anyway. – ForgeMonkey Oct 27 '14 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.