Two HC-05 modules. One is commanded to ROLE 0 The other is commanded to ROLE 1.
CMODE is set to 0 on the "ROLE 1" module.
Each is connected to its own UNO. Each responses as hoped ("OK"). However, I am unable to "BIND" the two modules. I have tried a variety of formats of mac addresses in the BIND commmands. Most errors are type zero (i.e. "ERROR(0)" ).
- Should I be using the BIND Command?
- Are there other appropriate "AT+" commands to connect the two modules "(master" and "slave")
- If you succesfully BIND two HC-05 modules please illlustrate the BIND command (including mac address format) you use.
Sketch code below:
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(11, 12); // RX | TX
void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command mode
delay(5000);
}
void loop()
{
digitalWrite(9, HIGH);
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
// Serial.println(Serial.read());
}
Thanks for your future assistance.