I ran this code on my HC-05 and it seemed to work, but when I replaced the HC-05 with an MLT-BT05, the only working command is "AT" and getting commands. For instance, if I type in "AT+ROLE" it replies with "+ROLE=0", but if I type in "AT+ROLE=1", it simply respond with "ERROR" with no other information. I have tried resetting it several time, checking to make sure the wiring is correct, checking and making sure the baud rate is correct, etc. I am sure it is in AT mode, given that using the basic AT command works.
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(9600); // HC-05 default speed in AT command more
Serial.println("GO");
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
Thank you!