ZS-040 (HC-05) blueetooth module Arduino Mega
Solution

Connection:


Bluetooth RXD to Arduino Mega pin 11
Bluetooth TXD to Arduino Mega pin 10
Bluetooth VCC to Arduino Mega 5V
Bluetooth GND to Arduino Mega GND


I used this code:

#include &lt;SoftwareSerial.h&gt;

#define RxD 10
#define TxD 11

SoftwareSerial BTSerial(RxD, TxD);

void setup(){
  // replace BAUDRATE as suggested
  BTSerial.begin(BAUDRATE);
  Serial.begin(9600);
  BTSerial.print("AT\r\n");
}

void loop(){

  if (BTSerial.available())
    Serial.write(BTSerial.read());

  if (Serial.available())
    BTSerial.write(Serial.read());

}


after setting AT mode as described in the tutorial above.

I tried running the code with BAUDRATE starting from 9600 to 460800: