Hello, I am facing a problem to communicate between my smartphone and Arduino Uno.
I have an HC05 BT connected to an Uno and I can connect via BT on my Galaxy A8. I have a very simple application:
Hallo Vidalv,
your Arduino code shall use two different serial lines: one for the PC monitor and another one to communicate with the BT shield.
Since you are using a UNO board you need to use the Softwareserial library in order to map the second serial line on two digital pins (10/11 ; 2/3 or others). There is plenty of tutorials on the community. Do a search, you'll find surely the help you need. If you have still problems ask again.
Meilleures salutations,
Ugo.
PS: en pièce jointe tu peux trouver un fichier txt qui contient le logiciel en Arduino et un .aia que j'avais déjà développé pour un autre membre de la communauté. Ils doivent marcher. (je suis Italien donc mon Français est très pauvre..... )
Hallo Ugo, thank you, it's the truth, in fact I took a code with the application for the smartphone and I didn't look at the Arduino code. In fact, all the protocol for retrieving the chain of characters from the phone to the Uno is missing.
So it can't work !!!
I think by adding: SoftwareSerial mySerial (10, 11); for example I will be able to recover what is happening at the port of the HC05 .....
Thank you, it's a blunder!
Vincent.
Thanks a lot Juan Antonio, using TX / RX of the Arduino its disables the ability to access the Serial Monitor, I prefer to create a dummy port (in my case Pin 10 and 11) so I can see what is happening.
Here is my code that works now!
Hello Juan Antonio,
you can't use the PC monitor and the BT shield connected at the same port otherwise the PC can't download the software to the board. If you do so, you always have to disconnect the BT shield before downloading a new code to the UNO.
In my experience is far better to have the BT connected on a couple of available pins by using the SoftwareSerial (the only care to take is to avoid too fast baudrates: 38400 is good enough for many applications).
Futhermore any character sent on Serial will go both to the PC monitor and to the HC05, therefore is sent also to the BT sender. This can lead to a "confusion" on BT sender side (The BT sender receives the character sent to the Serial Monitor as an echo ...).
Cheers, Ugo.
.