Skip to content

Instantly share code, notes, and snippets.

@xeonqq
Created December 3, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeonqq/bd01f04fb03ba5fb92e8 to your computer and use it in GitHub Desktop.
Save xeonqq/bd01f04fb03ba5fb92e8 to your computer and use it in GitHub Desktop.
try to find the baudrate of the bluetooth module (not tested)
void tryBT()
{
delay(20000);
led_green_flash();
long baudrates[5] = {9600, 19200, 38400, 57600, 115200};
String inputString="";
for (int i =0; i< 5; i++)
{
DebugSerial.begin(baudrates[i]); // debug output
DebugSerial.println("AT");
while (DebugSerial.available())
{
char inChar = (char)DebugSerial.read();
inputString += inChar;
}
if (inputString == "OK")
{
LogSerial.printf("found baud: %ld", baudrates[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment