Hi @martijn,
it seems that you are facing permission issues.
To verify if the communication between your phone and the HC05 is working, please use the following app (free) from ghoogle playtore:
Serial Bluetooth Terminal
Once you are done with that and you have verified that the communication works (in terms of hardware and phone <=> Hc05 compatibility), you can go deeper in your app.
Have you perhaps used my code (both AI2 and Arduino) the I've posted at the beginning of the thread?
Have you granted the cossing of Tx and Rx wires between Nano and HC05 ?
Cheers
Not necessarily !
The pins that SoftwareSerial uses (as far as I know) shall be capable of PWM, so you can use other pins provided that they feature the PWM capability. Im my drawing, that I posted at the beginning, the pins were D2 and D3. please refer to that drawing an take care of the wiring, as well !
PS The same sw that I sent you is working for other users (just posted to them yesterday). Have you changed the IP address of the HC05 in the AI2 block ?
The code that I've sent contains my HC05 address in a text constant, you shall overwrite it with your HC05 address.
Your Arduino Nano code should look like:
Can u send me that code ?
your app and the code i downloaded again from above part dont work sadly
i changed the HC-05 adress again but no luck at all....
OK, you can find it attached.
I've just modified it to help another user that wanted to acquire a pushbutton and send its value to the app, nevertheless, this added part isn't influencing the transmission. BT_Monitor_Nano.ino (3.0 KB)
Hoping it can help.
PSThe Serial BT Terminal app works ?
Hi @martijn_vd_brakel,
I'rewritten both AI2 and Arduino codes and checked again on my desk (I have a HC06 but is the same in terms of coding and performances).
Please take care of line 25 where I've set the baudrate between HC06 and Nano: if you see garbage(on both sides, AI2 and Nano serial monitor) this means that the baudrate is incorrect. Then try 19200 or 38400.
As far as the AI2 code is concerned, I've modified it in order to allow the selection of the (paired) BT devices reachable by the phone : just tap on the grey area named BTdevices, and then tap on the wanted address when shown in a list.
Hit on the CONNECT pushbutton: the label BT connected shall become green. Otherwise a popup appears to warn the insuccess.
Once connected, by pushing any button A,B,C you should read the feedback in the cyan label. BT_to_Arduino.aia (26.3 KB)
Got the PROBLEM !!!!
its my new phone ( i think android 12 problem )
Put the code on my old phone ( android 8) and it works flawlessly...
Now i need to find out what and how to get it working on android 12 but thats for later on.
I will try and get the servo app working on my old phone and see how to make it work for my project...
Thanks for your excellent help , i will keep u posted how its going on !!!
I think on android 12+ you need permission for Bluetooth-connect and bluetooth-scan too. At least it worked that way, i do not know if it changed or not recently.
Are you using bluetooth classic or ble?
For Bluetooth classic see below
Taifun
(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)
The easiest solution, for immediate relief
(from @Barry_Meaker) ...
I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).
on your phone,
goto settings
search for your app
in App Info for your app select Permissions
change Nearby Devices from Not Allowed to Allowed
Done
By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.
A more complex approach, for professional app development:
the man who designed the track and i did it !!!!
we made the app to work with the ESP32 BRIO_Controller4colors.aia (1.9 MB)
now we are finding out how to connect more then 1 esp to the program so we can control more then one track
Then you have to change from bluetooth to wiFi. Or use both BT and WiFi. If you chose the latest on you can keep your BT connection to the master EPS and the master ESP control the slave ESP-s over WiFi (ESP softAP can handle only limited number of connections). In case of the first option you need a router. You connect every ESP and the phone to the router. Maybe there is a third otion. If you keep BT to the master ESP, they may can to communicate with each other over ESP-NOW protocoll. Althoug I do not know how it is work exactly but i know one ESP can connect to multiple one.