arduinobluetoothusart

HC-06 not responding to AT command


I am using an Arduino R3 Mega 2560. I have an HC-06 Bluetooth Module connected as shown below:

HC-06 | Mega R3

VCC--330-ohm - 5V

GND ---- GND

TXD ---- RX, 0

RXD ---- TX, 1

When I input 'AT' (without quotes) into the serial monitor at 9600 baud, the module does not respond.

I am not paired with the module as it is blinking rapidly.

I don't know if this is related but the Arduino board is powered using a USB cable connected to my computer.


Solution

  • Edit: Thanks to Delta_G, I got the module to work (after a bit of irritation.) Here is the code:

     void setup() {
      Serial.begin(9600);
    
      Serial.println("Enter AT command.");
    
      Serial1.begin(9600);
    
    }
    
    void loop() {
      if (Serial1.available()) {
        Serial.write(Serial1.read());
      }
    
      if (Serial.available()) {
        Serial1.write(Serial.read());
      }
    
    }
    

    This is assuming that the HC-06 default baud rate is at 9600. When I typed 'AT' without line endings (so the None option in the Serial Monitor), it returned "OK." Again, "AT" with line endings did not work for me. If this is not the case with someone else, I'd be happy to hear it.