HC05 doesnt send data from phone to pc

I witnessed a problem where hc05 sent data from pc to phone but it works only in one way. So when i try to type from my phone ,pc cant get that data

#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX=3, TX=2

void setup() {
  Serial.begin(9600);   // PC communication
  mySerial.begin(9600); // HC-05 communication
  Serial.println("Ready! Send data from phone...");
}

void loop() {
  // Check if HC-05 is sending data (Phone β†’ Arduino)
  if (mySerial.available()) {
    String data = mySerial.readStringUntil('\n');
    Serial.print("Received: ");
    Serial.println(data); // Print to Serial Monitor
  }

  // Check if Serial Monitor is sending data (PC β†’ Phone)
  if (Serial.available()) {
    mySerial.write(Serial.read()); // Relay to HC-05
  }
}

that is the code . i checked connection of wires and it is ok ,also i made a loopback test so both tx and rx is working

pls help meUse code tags to format code for the forum

1 Like

Please, wrap your code like this...

Can you also post the "loopback" test you did?

1 Like

You are going to need a picture of a hand drawn wiring diagram, what you describe seems to be missing at least one part. Also Use the Tools Auto Format command before posting your code in code tags.

1 Like

i just connected the tx to rx on HC05 and write a message in serial monitor from phone .Eventually that message was receive back

i checked wires and find out that there was a problem. Thanks you all for help and now everything works

1 Like