Problem with arduino HC-05

Here's the problem: the module does not respond to anything when switching to AT-command mode, only the LED flashes once every 2 seconds (it seems like it should be, so it's in AT-command reception mode), but I'm very bad at Arduino, so I found code on the Internet that allegedly allows you to control the module using AT commands: //The beginning of the sketch

#include <SoftwareSerial.h> // name password speed CMODE get address write address role //request AT+NAME? AT + PSWD? AT + UART? AT + CMODE? AT + ADDR? AT + BIND? AT + ROLE? //answer option +NAME:SLAVE +PIN:"1234" +UART:9600,0,0 +CMODE:1 AT+BIND=18,E4,400006 +ROLE:0 //for slave | AT+NAME=SLAVE AT+PSWD="1234" AT+UART=9600,0,0 AT+CMODE=1 +ADDR:18:E4:400006 AT+ROLE=0 //for master | AT+NAME=MASTER AT+PSWD="1234" AT+UART=9600,0,0 AT+CMODE=0 AT+BIND=18,E4,400006 AT+ROLE=1

//resetting the AT+ORGL settings is an extreme case if you messed up something with the settings and can't find a way to fix it

const int arduino_rx = 5; const int arduino_tx = 6; SoftwareSerial mySerial(arduino_rx, arduino_tx);

void setup() { pinMode(arduino_rx, INPUT); pinMode(arduino_tx, OUTPUT); Serial.begin(9600); mySerial.begin(38400); Serial.println("<<< Start! >>>"); mySerial.println("AT"); }

void loop() { if (mySerial.available()) { char c = mySerial.read(); Serial.print(c); } if (Serial.available()) { char c = Serial.read(); mySerial.write(c); } }

Everything turned out well for the person in the video, the module brought OK to the series, and everything is fine, but this does not happen for me, the start message is just displayed, the module does not respond to attempts to enter AT commands in any way. Does anyone know how to fix this, or at least how to get him out of this mode? Before that, the module seemed to work, but I could send a message from the arduino to the phone, but I need the opposite, that is, from the phone to the arduino, and now the module remains in this mode, and I can't use it at all.

(title edited for search results)

Please post your full sketch, using code tags when you do. This prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

If it was YouTube... they only do it for clicks. Maybe share the link, so the needle can be found in the straw. For now, try this for now... read every last detail, including the part about the voltage divider...

Also... when you post code, you should use the <CODE> button to start a code block, then paste your formatted code over the words (not the two sets of three tick marks) ```type or paste code here``` which should result in something that looks like this...

#include <SoftwareSerial.h>
// name password speed CMODE get address write address role
// request AT+NAME? AT + PSWD? AT + UART? AT + CMODE? AT + ADDR? AT + BIND? AT + ROLE?
// answer option +NAME:SLAVE +PIN:"1234" +UART:9600,0,0 +CMODE:1 AT+BIND=18,E4,400006 +ROLE:0
// for slave | AT+NAME=SLAVE AT+PSWD="1234" AT+UART=9600,0,0 AT+CMODE=1 +ADDR:18:E4:400006 AT+ROLE=0
// for master | AT+NAME=MASTER AT+PSWD="1234" AT+UART=9600,0,0 AT+CMODE=0 AT+BIND=18,E4,400006 AT+ROLE=1
//resetting the AT+ORGL settings is an extreme case if you messed up something with the settings and can't find a way to fix it

const int arduino_rx = 5;
const int arduino_tx = 6;
SoftwareSerial mySerial(arduino_rx, arduino_tx);

void setup() {
  pinMode(arduino_rx, INPUT);
  pinMode(arduino_tx, OUTPUT);
  Serial.begin(9600);
  mySerial.begin(38400);
  Serial.println("<<< Start! >>>");
  mySerial.println("AT");
}

void loop() {
  if (mySerial.available()) {
    char c = mySerial.read();
    Serial.print(c);
  } if (Serial.available()) {
    char c = Serial.read();
    mySerial.write(c);
  }
}

And... why start with something so involved. Do you understand any of the AT mode configuration settings? My advice would be to learn about the Arduino and many of its functions before venturing into "copy/paste" - because you end up relying on others to solve your problems, when programming electronics is about solving your own problems with little to no assistance.

It probably is, and it probably does, but you won't get a result if it is improperly connected, so it would help if you showed your wiring.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.