Problems with bluetooth and HC05

Hi guys,

I'm having troubles with my HC05 module to send data from my Arduino Micro to my phone.
Even with a basic code like this one, i'm still unable to read messages on my phone when i print it in the serial monitor of Arduino…

#include <SoftwareSerial.h>

SoftwareSerial mySerial(8, 9); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

I use a basic "Bluetooth terminal" app on my android phone. It's weird because it works just fine when i try to send data from the phone to the Arduino monitor.
Could you tell me what could be the problem please ? :slight_smile:

Thank you !

i'm still unable to read messages on my phone when i print it in the serial monitor of Arduino…

What do you mean by "print it in the serial monitor"? What are your expectations?

With your code, if I enter some text in top box of the serial monitior and press send, it shows on the phone. If i enter text on the phone and press send it shows on the serial monitor.

if I enter some text in top box of the serial monitior and press send, it shows on the phone

This part doesn't work...

i enter text on the phone and press send it shows on the serial monitor.

While this one works well

This part doesn't work...

It's not a problem with the code. Check carefully the RX/TX connections between the Arduino and the module. If you are using jumper wires, try new ones. If the module RX connected through a voltage divider to the Arduino TX in order set 3.3v check those connections.

Your code is behaving as if the connection from the Arduino TX pin 9 is not getting to the module RX pin.