I bought two HC-05 modules on eBay.
They seem to work. I have the voltage divider for the RX. The HC-05 baud rate has been changed to 115200.
I am using a Bluetooth Terminal on my Android smartphone to send the HC-05 text.
If I send a relatively short message of 4 or 5 characters, the HC-05 receives it okay. But if I send a message of 10 characters, some of the letters are wrong.
I am using the following sketch to see what the HC-05 is receiving.
What else should I be doing to make the communication more robust?
#include <SoftwareSerial.h>
SoftwareSerial BTserial(13, 12);
// Connect the HC-05 TX to Arduino pin D13.
// Connect the HC-05 RX to Arduino pin D12 through a voltage divider.
void setup()
{
Serial.begin(115200);
Serial.println("Arduino is ready");
// HC-05 has been set to 115200 by another sketch
BTserial.begin(115200);
Serial.println("BTserial started at 115200");
}
void loop()
{
char aByte;
if (BTserial.available() > 0)
{
// text arrived in from BT serial
//
aByte = BTserial.read();
Serial.println(aByte);
}
else
{
}
}