I'm trying to connect two Arduino with Bluetooth, but I have trouble connecting my bluetooth Bee 2.0 to my HC-06 module... I searched on Google and tried many different things, but it seems like I'm missing something important. Could someone give me an advice, please ?
petersuib:
I did, but I don't understand : when the master got the slave adress, is it supposed to automatically connect to it ? If not, how can I do this ?
I presume this question arises from some of the DFRobot example code?
If so you need to post the program so we can see what you can see.
In fact there is no sample code on the DFRobot page, only some commands to set up the module, like the one which allows to bind a master to a slave module (the master being my Bee 2.0 and the slave my HC-06) : AT+BIND=1234,56,abcdef (which corresponds to the slave adress). I did bind the two of them, but it seems like it needs something else to connect.
If you want some code, here is what I wrote to test the connection :
Thanks, this tutorial is way better than the other ones ! My two modules are now paired and everything but my Arduinos still can't communicate... I checked the Baud rate and it's 9600 on both, I also checked the program but I can't find the new problem x).
I used his code
In AT mode the bluetooth modules were communicating but when I connect them to an Arduino nothing happens. Maybe this is an hardware issue ?
This is incoherent. It may nonetheless be just a matter of procedure.
When you say "communicating", communicating with what?
With bluetooth modules, there are two communications operations:
Arduino<>Bluetooth by wire
Bluetooth<>Bluetooth by wireless
Proof of one is not proof of the other.
If you have been able to configure Bluetooth, there is nothing wrong with the wiring. The wireless operation can be tested by checking that you can see it with a phone. I believe even an iPhone can do this. I believe the last thing you should suspect is the hardware.
HC-05 cannot communicate with another bluetooth while in AT mode, so make sure it isn't.
Well, I can see both of the modules with my phone and I'm almost sure that they are comunicating by bluetooth, and the reason I doubt for the hardware is that the Bee 2.0 (which I use like an HC-05) needs a direct connection to the computer with a special wire to be configured in AT mode; we cannot configure it by wiring it to the Arduino... That's why I think the issue is from the wires, because I cannot find any other solution.
Being "almost sure that they are comunicating" is the same as being a little bit pregnant. And your post is still incoherent. One thing you need to be clear about whether you have actually configured HC-05 or not - by whatever means. If not, I guess you should not be "almost sure that they are comunicating" at all. I don't know anything about Bee2.0, but it has a switch for selecting AT mode, so I don't see why you need a special wire. Further, if you are configuring with PC, I fail to see how the wiring can be at fault. You can hardly connect it the wrong way round, although you might test the cable on something else. DFRobot has stuff on these, and I imagine that is all you need. At a guess, the same switch would be used with Arduino, and you only need four wires to connect.
I did everything said in the tutorial : baud rate to 9600, same passwords, pairing, linking and binding the Bee 2.0 to the HC-06, and they do connect because their LEDs stops blinking 5s after powering them on. In fact, the only thing (to me) that could be the answer is the baud rate, but I checked it again and again... I know the wires are not the problem because I tested them, but at my level I just can't see what's wrong.
What if I want my modules to read and send data at the same time ? If I use Serial1.read() and Serial1.write() at the same time, it will only read what it just wrote isn't it ?
petersuib:
Wtf ?? When I pin DRX(Bee 2.0) to RX(Arduino) and DTX(Bee 2.0) to TX(Arduino) the code works ! I don't understand
Nor do I, but the only thing I know about Bee is its eyewatering price. I can only assume that Bee Rx should be connected to Arduino Rx because it is also connected to Bluetooth Tx. Anyway, it looks like you have solved the problem.
petersuib:
What if I want my modules to read and send data at the same time ? If I use Serial1.read() and Serial1.write() at the same time, it will only read what it just wrote isn't it ?
Who would know? It seems a pointless exercise anyway. My GUESS is that Arduino can't handle it, even if bluetooth can.