0

I am working on a project that requires a connection between two BT modules (HC-05) and a mobile phone. Later on, I encountered a problem: I can't connect two BT modules to one at the same time, So I thought about the possibility of ending a connection and starting the other one when needed. If that was possible, how can I do that in an arduino code?

One of the BT modules is a master which means it can't connect to the phone and it has to be a master because it must be connected to the other slave BT module.

1 Answer 1

0

Send AT+ROLE=1 to BT module to set module into master role. To set module back to slave mode, send AT+ROLE=0

Also check this video, you have source code in the description. It will help you understand how to do it.

12
  • But that requires reversing the rx-tx connection to enter the AT mode from the connection being used to send and receive data, which as far as I know can't be done during the code execution as the pins setup is being configured once at the beginning of the code. Commented Nov 25, 2018 at 11:48
  • Can you share your code? Serial comm(RX TX) is two way communication
    – Pararera
    Commented Nov 25, 2018 at 11:50
  • I haven't written a code yet. Commented Nov 25, 2018 at 11:52
  • Try with this command. You can't know without the code
    – Pararera
    Commented Nov 25, 2018 at 11:54
  • 2
    @SilvioCro, the trick with connecting RX to RX, TX to TX is that then the USB chip is connected RX to TX to module and you can talk to module from the Serial Monitor. The main MCU must have a sketch without Serial.begin() (empty sketch or Blink)
    – Juraj
    Commented Nov 26, 2018 at 8:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.