HC-05 Bluetooth problem in activating AT mode

I used a simple sketch shown below to activate the AT mode but every time I write commands in the serial monitor I don’t receive any answer(OK)

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2, 3); // RX | TX

void setup()
Serial.println(“Enter AT commands:”);
BTSerial.begin(38400); // HC-05 default speed in AT command more

void loop()
if (BTSerial.available()) // read from HC-05 and send to Arduino Serial Monitor

if (Serial.available()) // Keep reading from Arduino Serial Monitor and send to HC-05

I used the code at teh bottom to connect the TX of the HC05 to the pin 2 of the motherboard and RX to pin 3. I don’t unerstand why in AT mode I have nothing as a reply.

I tried another method were using a phone to turn on a led but when I give command with the phone the BT module doesn’t see anything. That’s why I think the problem is the HC05 not receiving but I don’t know how to solve it.

Your problem is not clear, nor is your intention. Note that Bluetooth cannot communicate while in AT mode, or execute AT commands while in comms mode. You don’t say what the LED is doing.
Just get to use Bluetooth before you start any AT mode stuff. You might find the following background notes useful.


Why do you think the module is in AT mode, not in regular mode?

Do you have TX/RX crossed and a voltage divider on Arduino's TX to kill the HC-05 which runs at 3.3V?

The baud rate while in AT mode is 38400.

Here is a good page on using the HC05 in AT mode.