3.- Change baud rate in HC-06. AT commands.
HC-06 has 9600 bauds by default. Let's change it.
We make this connection. Notice that I have now connected the module to terminals 2 and 3 of Arduino.
We load this sketch:
// Juan A. Villalpando
// http://kio4.com/arduino/9L2_enviar_archivo_BT.htm
#include <SoftwareSerial.h>
SoftwareSerial BT(2,3);
void setup()
{
BT.begin(9600);
Serial.begin(9600);
// BT.begin(115200);
// Serial.begin(115200);
}
void loop(){
if(BT.available()) {Serial.write(BT.read());}
if(Serial.available()){BT.write(Serial.read());}
}
Serial Monitor: 9600
We wrote:
AT+BAUD8
and get OK154200
AT+BAUD1 ——— 1200
AT+BAUD2 ——— 2400
AT+BAUD3 ——— 4800
AT+BAUD4 ———9600 (Default)
AT+BAUD5 ——— 19200
AT+BAUD6 ——— 38400
AT+BAUD7 ——— 57600
AT+BAUD8 ——— 115200
we already have our HC-06 set to 15200 baud.
IMPORTANT, keep in mind that now it works with 115200, if you want to put the speed back to 9600, you must reload the sketch .ino, but changing these lines:
// BT.begin (9600);
// Serial.begin (9600);
BT.begin (115200);
Serial.begin (115200);
You must also set the Serial Monitor to 115200
Type AT + BAUD4 and it will be set back to 9600.