Go Down

Topic: Communication between 2 Arduinos using bluetooth. (Read 109 times) previous topic - next topic

selametia

So i am working on this project where i need to communicate between Arduinos using HC-05 modules.

The thing is that the master needs to switch between multiple slaves during the communication and therefore needs to be able to change the AT commands during the communication.

ATM i have made it possible for a HC-05 master and a HC-06 slave to connect to each other (i can see that they connect by the light flashing correctly on the modules) however whenever i send any data from the master towards the slave, it doesn't receive anything at least only 1/100 times.


master:
https://pastebin.com/RqdGkQUg

slave:
https://pastebin.com/a5hcSjpG

I am new to the forum and don't know how to poste code, that is why i made pastebins

groundFungus

#1
Apr 19, 2018, 02:07 pm Last Edit: Apr 19, 2018, 02:09 pm by groundFungus
The "how to use this forum-please read" stickies tell you how to post code.  See #7.  Please use  auto format (ctrl-t or Tools, Auto Format) to properly indent the code before posting.

Nick_Pyner

#2
Apr 19, 2018, 02:40 pm Last Edit: Apr 19, 2018, 04:30 pm by Nick_Pyner
The thing is that the master needs to switch between multiple slaves
Does it? It is possible to do this by cutting the power and re-programming on the fly, but have you considered an NRF24 network instead? It is made for that sort of thing.

Robin2

Using nRF24L01+ transceivers will be much easier if you need a system with a master and multiple slaves.

Have a look at this Simple nRF24L01+ Tutorial. It includes an example for a master and 2 slaves that can easily be extended to a larger number of slaves.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up