Skip to main content
  1. Use a macro like this to send AT commands:

     #include <SoftwareSerial.h>
    
     SoftwareSerial btSerial(2, 3); // RX, TX
     /*
      * Connect pin 2 Arduino to pin TX HC-06 
      * Connect pin 3 Arduino to pin RX HC-06
      */
     void setup() {
    
     Serial.begin(9600);
    
     Serial.println("Enter AT commands:");
    
     btSerial.begin(9600);
    
     }
    
     void loop()
    
     {
    
     if (btSerial.available())
    
     Serial.write(btSerial.read());
    
     if (Serial.available())
    
     btSerial.write(Serial.read());
     delay(1000);
     //btSerial.print("AT+PIN4321");
     //btSerial.print("AT+NAMEAlibaba");
     //btSerial.print("AT+BAUD4");
    
    
     }
    
  2. You may have another port set on the HC 06 instead of 9600, like I had. If so, try this code with all the possible port numbers and changing something like the password, and everytime you run the code - go check if it worked, this way you will find in wich port number you have your module.

good luck