HC-05 Pairing Issue

I am trying to pair my HC-05 but I do not think it's working. On the slave module, I use the following AT Commands:

AT=Role=0
AT+UART=38400,0,0
AT+PSWD=1234
AT+ADDR? --> and I write down the address

For the master, I am using the following:

AT+Role=1
AT+UART = 38400,0,0
AT+PSWD=1234
AT+CMODE=1
AT+BIND= "address of slave"

The problem I am seeing is that when I press enter to configure on the master, I get the "OK" on everything but the BIND command. However, when I place them both onto my two Arduino Megas, they blink like they should but it doesn't complete the function. Any suggestions?

Sorry, attached is the setup I use for conducting this. I have two Arduino Mega 2560 cards and two HC-05 (six pin) modules

Why are you using SoftwareSerial on a board with 4 hardware serial ports - three of which are unused?

What are you using to send the serial data TO the Arduinos?

I am just using what I have watched on video tutorials. Some have had blank sketches as well. What should I be using? I am completely new to all of this.

What should I be using?

Connect the bluetooth device to TX1 and RX1 and use Serial1 to read from/write to it.
Or, connect the bluetooth device to TX2 and RX2 and use Serial2 to read from/write to it.
Or, connect the bluetooth device to TX3 and RX3 and use Serial3 to read from/write to it.

AND, answer ALL of the questions asked.

I am not sure what you are asking exactly ("What are you using to send the serial data TO the Arduinos?") I am typing my stuff through the serial monitor on the arduino app on my computer.

I am typing my stuff through the serial monitor on the arduino app on my computer.

So, you did know what I meant.

So, what line ending setting do you have selected?

After you have used that sketch to configure them, what sketch(es) are you using to actually use them?

I am using line ending: NL+CR.

where are the serial1, serial2 and serial3 located?

ok, so here is what I am doing. I am connecting a Bluetooth module to a card that has a LDR attached. I need it to send the signal to the other card (with Bluetooth) to turn on LED. I have attached a schematic and my code.

MASTER

#include<SoftwareSerial.h>

SoftwareSerial BT(9,10);  //connect Bluetooth ->rx(9) tx(10)
#define LED 13
uint32_t c=0;
void setup() {
  Serial.begin(9600);   // Default baudrate
  BT.begin(38400);       //Bluetooth Baudrate
  pinMode(LED,OUTPUT);
  }
void loop() {
  if(BT.available()>0)
 {
  c=BT.read();
 }
  if(c<=150)
  {
    digitalWrite(LED,LOW);
  }
  else
  {
    digitalWrite(LED,HIGH);
  }
     
 delay(100);
}

SLAVE

#include<SoftwareSerial.h>
SoftwareSerial BT(9,10);    //connect Bluetooth ->rx(9) tx(10)
#define light A1
uint32_t state=0;
int lightState=0;
int c;
void setup() {
  pinMode(light, INPUT);
  Serial.begin(9600); // Default baudrate
  BT.begin(38400);   //Bluetooth Baudrate
}
void loop() 
{
    state = analogRead(light); // Reads the data from analog input
    state=map(state,0,1024,0,255);
    BT.write(state);
    delay(100);
}

where are the serial1, serial2 and serial3 located?

On the bottom shelf, under the higher priced Serial1, Serial2, and Serial3 brands.

Have you LOOKED at your Arduinos? Have you noticed that there are labels next to the pins? Get a magnifying glass, if you need to. (I do.)

Have you looked at the documentation for SoftwareSerial? Do you see pin 9 listed in the supported pins for the Mega? I don't.

Are you referring to this - {If using multiple software serial ports, only one can receive data at a time.
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).}

Also, I can see quite well and nothing on my MEGA 2560 is labeled Serial1, Serial2 or Serial3. However, I do know that all the communication pins are serial pins as well as TX0 AND RX0.

And no, I see that 9 is not supported.

So, what do I need to do. Like I said, I am very new to this.

so, I guess what I am asking, because it appears I am approaching this very wrong, is how do I pair two HC-05 modules using two Arduino MEGA 2560 cards?

So here is what I am gathering at this point:

HC-05 Arduino MEGA
EN/KEY Serial 1 (wherever that is)
VCC 5v
GND GND
TX TX1
RX RX1
STATE .......

Is this correct?

Also, I can see quite well and nothing on my MEGA 2560 is labeled Serial1, Serial2 or Serial3.

I know that. However, there are two pins labeled RX1 and TX1. Those pins are linked to the Serial1 instance. There are two pins labeled RX2 and TX2. Those pins are linked to the Serial2 instance. There are two pins labeled RX3 and TX3. I'm sure you can guess which SerialN instance they are linked to.

OK, I understand that part now. So with that said, do I need to connect the EN/KEY pin to anything? Also, does this just apply to the AT Command piece and then connect it as the code is displayed above for my project?

do I need to connect the EN/KEY pin to anything?

I don't know.

then connect it as the code is displayed above for my project?

No. You do NOT change the wiring to the bluetooth module after you get it configured.

so with all that you have said....how do I connect the HC-05 modules to the Arduino board to pair them?

EN -->
VCC -->
GND -->
TX -->
RX -->
STATE -->

As you can tell, I am trying to learn this as I try to complete an extremely important project. I really need to be able to get the above code to work between the two Arduino cards utilizing the HC-05 Bluetooth Modules.

Would it be easier to use the Arduino UNO?

BT Tx > Rx1 and
BT Rx < Tx1
The names on the pins are their functions.

and no, it is actually more convenient to use a Mega. All you need to do is learn what it is, and use it properly, not go out and buy more hardware.

In order to walk before you run, you might find the following background notes useful

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

Thank you for the information. I will read this and then try the test as well and report back. Thanks again.