How to get the BAUD value of a bluetooth device without knowing it

Hello lovely arduino community,

i have a probem with my bluetooth device and i was wondering how i could debug it.

Im using the HM-10 and was setting the BAUD to different values. Suddenly i cant receive anything anymore. Im not sure which BAUD value is set on my device. Is there a way to debug it?

My Arduino code looks like this:

#include <SoftwareSerial.h>

SoftwareSerial SerialBt(2, 3);

void setup()
{
    Serial.begin(9600);
    SerialBt.begin(9600);
}

void loop()
{
    if (SerialBt.available()) {
        Serial.write(SerialBt.read());
    }

    if (Serial.available()) {
        SerialBt.write(Serial.read());
    }
}

A simple solution is to write a short program that sends a suitable message at different baud rates and waits for a reply - with a suitable timeout. When the reply arrives you will have the correct baud rate.

...R

AliceTheCat_:
Im using the HM-10 and was setting the BAUD to different values. Suddenly i cant receive anything anymore.

Since you have been setting the baud rate, the simplest solution is to set it again to the baud rate you want. The baud rate you require in order to set the baud rate you want to actually use is always the same - 9600.

Ok, i somehow fixed the issue. Cant say what the issue was because i have changed and tried so many things at the same time.