How to recieve data from HC 05

Hi. I am working on a bluetooth car. I wanted my arduino uno to send me a message if I am already connected. How do I make the arduino do this? I already tried,

Serial.println("Connected")

And

Serial.write("Connected")

It all does the same thing: it only displays it in my serial monitor not in my phone. Help please. Tha k you.

Post all your code.

Read the forum guidelines.

Format your code with the IDE autoformat tool before posting code.

Post a schematic of your wiring.

You imply you want Arduino to tell the phone that Bluetooth is connected. It cannot do that and it is a pointless exercise anyway. The phone will tell you that it is connected to Bluetooth. Bluetooth has two communications facilities

  1. by wire with Arduino
  2. by wireless with the phone
    Neither the phone nor Arduino know this, and it is down to you to make both work properly.

You might find the following background notes useful.

I used the statepin in the hc05. But if I want to send some data from hc05 to arduino, that is my question.:grinning::grinning::grinning:

I understand he state pin doesn't work with all versions. If you have succeeded in that, I guess you can then send a confirmation to the phone. You could always echo whatever you sent from the phone. That should always work. The above programme does that - phone initiated, not Arduino initiated. You may only need to do either of this in Setup.

It depends to which pins it is connected.

If the module is not connected to pins 0 and 1, you will need to use the SoftwareSerial library.

If the module is connected to pins 0 and 1, you might have swapped TX and RX.

Yes the state pin works for me. But I think the problem is in my custom app. I will try to use Serial.print() again and re-edit my custom app.