0

I got the ble module to work fine following online guide. However when i changed the baud rate: AT+BAUD1 which changed to 19200 however ever since i was not able to get at commands to work.

tried: arduino nano, FTDI programmer, software serial, normal tx, rx

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(8,9); //RX|TX


void setup(){
  Serial.begin(9600);
  BTSerial.begin(9600); // default baud rate
  while(!Serial); //if it is an Arduino Micro
  Serial.println("AT commands: ");
}

void loop(){
  //read from the HM-10 and print in the Serial
  if(BTSerial.available())
    Serial.write(BTSerial.read());

  //read from the Serial and print to the HM-10
  if(Serial.available())
    BTSerial.write(Serial.read());
}
  • 1
    If you set it to 19200, why are you using 9600? – gre_gor Dec 10 '17 at 4:01
2

You changed the baud rate that the Bluetooth module uses to communicate with your Arduino but you forgot to change the baud rate that the Arduino uses to communicate with the Bluetooth module. These must match. From consulting the SoftwareSerial library's reference page, you can see that is set by this line of your code:

BTSerial.begin(9600)

That sets the software serial communication rate at 9600 baud. You need to change it to this:

BTSerial.begin(19200)

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.