Hm-10 bluetooth module only returns OK after any AT commands

I bought a Hm-10 bluetooth module (BLE 4.0) to use in my school project. So, every command that i send to it, it returns always an “OK”. Do you guys can help me ?

#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11); // RX, TX
String command = ""; // Stores response of bluetooth device
void setup()
{
  Serial.begin(9600);
  Serial.println("Type AT commands!");
  BT.begin(9600); // HC-06 usually default baud-rate
}

void loop()
{
  if (BT.available()) // Read device output if available.
  {
    while(BT.available()) // While there is more to be read, keep reading.
   {
     delay(10); //Delay added to make thing stable 
     char c = BT.read(); //Conduct a serial read
     command += c; //build the string.
    } 
    Serial.println(command);
    command = ""; // No repeats
  } 
  if (Serial.available())
  {
    delay(10); // The DELAY! ********** VERY IMPORTANT *******
    BT.write(Serial.read());
   }
}

And it’s my bluetooth module (I guess it isn’t the CC41 one…)

Thanks…

I just ran into the same issue.

Seems there's a 'guard time' around entering AT commands after the initial first two characters, and you won't be able to type it fast enough. Had a similar issue with the radio modem on my Android a couple of years ago. The-10 just responds OK before I can even get the '+' char entered. You've basically just got to send it as an entire block, or do it via script / data transfer / whatever. Typing is too slow.

Saw a script called "atinout" that does this, only Linux though.

Just tried it with 'minicom' and it works fine. Compose your AT commands in TextEdit or whatever simple tool, then copy & paste in minicom. Has the added benefit of keeping your config history and letting you double check before applying.

Good luck