Recognize two HC-05 bluetooth but with out any response

i have two arduino ,each arduino has a HC-05 bluetooth , so i define each one as a master and slave , but there is no data transfer between them , and the lights of the RX and TX didn't turn on in each arduino to know if there is any data transfer

so if any one can say to me what is the portable problem please .

can you send AT commands and receive a response ?
what Arduinos are you using?
post your code?

i just define a master as AT+ROLE=1 and the slave as AT+ROLE =0 ,and after that i bind the master with the id of the slave ,
the Arduino i use is for the master i use a mega arduino and for the slave i use uno arduino

// resever uno
#include <SoftwareSerial.h>
#define led1 8
#define led2 9
#define led3 10
#define led4 11
#define led5 13
char state = ' ' ;

void setup() {
pinMode (led1 , OUTPUT );
pinMode (led2 , OUTPUT );
pinMode (led3 , OUTPUT );
pinMode (led4 , OUTPUT );
pinMode (led5 , OUTPUT );
Serial.begin (115200);

}

void loop() {

if (Serial.available()>0)
{
state = Serial.read ();
Serial.write (state);
}

digitalWrite (led1 , HIGH );
digitalWrite (led2 , HIGH );
digitalWrite (led3 , HIGH );
digitalWrite (led4 , HIGH );
digitalWrite (led5,HIGH );

if (state =='&')
{
digitalWrite (led1 , HIGH );
digitalWrite (led2 , HIGH );
digitalWrite (led3 , HIGH );
digitalWrite (led4 , HIGH );
digitalWrite (led5,HIGH );
}
if (state==']')
{
digitalWrite (led1 , LOW );//ON
digitalWrite (led2 , HIGH );//OFF
digitalWrite (led3 , HIGH );//OFF
digitalWrite (led4 ,LOW);//ON
digitalWrite (led5,LOW );
delay(60000);
digitalWrite (led1 , HIGH );
digitalWrite (led2 , HIGH );
digitalWrite (led3 , HIGH );
digitalWrite (led4 , HIGH );
digitalWrite (led5,HIGH );

}
if ( state == '*');
{
digitalWrite (led1 , HIGH );
digitalWrite (led2 , HIGH );
digitalWrite (led3 , HIGH );
digitalWrite (led4 ,HIGH );
digitalWrite (led5,HIGH );
delay(60000);
}
if (state=='/')
{
digitalWrite (led1 , HIGH);
digitalWrite (led2 , LOW );
digitalWrite (led3 , LOW );
digitalWrite (led4 ,HIGH);
digitalWrite (led5,LOW );
delay(60000);
digitalWrite (led1 , HIGH );
digitalWrite (led2 , HIGH );
digitalWrite (led3 , HIGH );
digitalWrite (led4 , HIGH );
digitalWrite (led5,HIGH );

}

}

this is the slave code
, it will receive some char from the master like ] and / etc

I assume the HC-05s respond with OK to commands?
can you post a schematic showing how you have wired the devices
use code tags when uploading code?
in post #4 you include SoftwareSerial header file but I cannot see when you open a SoftwareSerial port?

yes , the HC-05 respond with ok
in master (mega ) and slave (uno ) have the same connection
vcc-vcc
gnd-gnd
RX-TX
TX-RX

is the amount of data (serial.print )in mega effect in it ?

Hai impostato la stessa velocità di comunicazione seriale (baud rate) via comandi AT a 115200 (come nel tuo sketch) su ambedue i moduli HC-05?
Inoltre sappi che la libreria SoftwareSerial non funziona a 115200 baudrate, per usare questo baud rate devi adoperare la porta Seriale Hardware, l'unica che può andare a questa velocità. Infine nello sketch hai dichiarato la porta seriale software ma non l'hai avviata con

Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

yes , is it effect ?
what is the best baud ?

Se usi la libreria SoftwareSerial il baude rate massimo è 57600, se usi la porta Seriale Hardware è 115200.

i wiil try it in 57600 now

it doesn't work

according to my notes on the HC-05

NORMAL MODE IS 9600
AT mode is at 38400baud

the code I have which worked with a Mega is

// HC-05 Bluetooth module AT commands
// note Serial1 baudrate is 9600

// using Arduino Due  (noteHC-05 Rx and Tx are 3.3V)
// Arduino %V and GND to HC-05 5V and GND
// Arduino pin 18 Tx to HC-05 Rx (if using a Mega use a level converter)
// Arduino pin 19 Rx to HC-05 Tx

void setup()
{
  Serial.begin(115200  );
  Serial.println("Enter AT commands:");
  Serial1.begin(9600);//38400);       // HC-05 default speed in AT command more
}

void loop()
{
  if ( Serial1.available())    // read from HC-05 and send to Arduino Serial Monitor
  Serial.write( Serial1.read());

  if (Serial.available())     // Keep reading from Arduino Serial Monitor and send to HC-05
  Serial1.write(Serial.read());
}

Edit: just connected a HC-05 to a Mega,

  1. paired with it from a PC using teraterm at 9600baud communicated OK
  2. paired with it from Android - communicated OK using Serial Bluetooth app

You have not defined the software serial pins, so it will not work

You can also forget about running software serial @ 115200, that won't work either.

It seems that you don't need software serial, but you do need to make up your mind about your intentions. If perchance you have actually done this, can we conclude the software serial is redundant?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.