title: Auto detecting Baud Rate of Arduino
body: <p>I'm trying to detect baud rate of Arduino Mega2560 by using C#. My code is below:</p>
  
  <pre><code>SerialPort SP=new SerialPort();
  SP.BaudRate = 115200;
  </code></pre>
  
  <p>BaudRate is specified as a constant like this, but I would like to automatically detect it.</p>
  
  <p>For instance, if Arduino code includes Serial.begin(xxxx), program should declare SP.BaudRate = xxxx.</p>
  
  <p>How can I do it?</p>