0

I'm trying to issue a connection via HM-10 from arduino (rather than my phone). However, I'm unable to start a connection from arduino using both AT+CON and AT+CONNL. When I try AT+CON I get OK+CONNA and when I use AT+CONNL I get OK+CONNE. Here's my code:

#include <SoftwareSerial.h>
SoftwareSerial bluetooth(8,9);


void setup() {
  Serial.begin(115200);
  Serial.setTimeout(50);
  bluetooth.begin(115200); //open BLE connection
  bluetooth.setTimeout(50); //set timeout
  bluetooth.write("AT+ROLE1");
  //bluetooth.write("AT+ROLE0");
  delay(50);
  bluetooth.write("AT+NOTI1");
  delay(50);
  bluetooth.write("AT+CONC40BCB403020");
  delay(50);
  //bluetooth.write("AT+CONNL");
}

void loop() {
    while (bluetooth.available() > 0) {
      String response = bluetooth.readString();
      Serial.println(response);
    }
}

The response that I get is:

OK+Set:1
OK+Set:1
OK+CONNA
  • Can you let us know what is the response to the commands AT+CON and AT+CONN after 10 seconds? – Sumit Panse Jun 7 '18 at 11:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.