2

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());
}
asked Dec 10, 2017 at 3:48
1
  • 1
    If you set it to 19200, why are you using 9600? Commented Dec 10, 2017 at 4:01

1 Answer 1

3

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)
answered Dec 10, 2017 at 6:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.