Android Question Bluetooth HC-05 connection error

Khalid.

Member
When press a connection status : error starting discovery process
 

Attachments

  • HC05LedOnOff.rar
    HC05LedOnOff.rar
    5.3 KB · Views: 525
  • IMG_٢٠٢٢٠٢٢٢_٠٠٤٢٥٢.jpg
    IMG_٢٠٢٢٠٢٢٢_٠٠٤٢٥٢.jpg
    79.7 KB · Views: 540
I guess that you are trying to communicate with a microprocessor via BT. I have been doing the same recently. I have downloaded your app and it does not work for me either. I do not have time to look closely at it right now, but here is my own test app that does work. Obviously the send and receive subroutines are set up for my own test purposes, but the pairing and connect procedure should work for you, and maybe show where you are going wrong.

I will try and take a proper look at your code when I get more time. It begins the pairing process, but something stops it being completed.
 

Attachments

Upvote 0
Okay - I have had time to look at your code now. I see that your approach is more sophisticated than mine, but I can run without problems on Android 11 so I think that I will stick with it for the time being. And I see that @ezpos has sorted you out, so you should be fine.
 
Upvote 0
Please go to the phone. Delete the bluetooth device. Then pair it again

The connection was made after the bluetooth was paired to the computer and the port was known, and then (((the pairing was canceled)) and I changed the Arduino port
bluetooth.JPG


But why doesn't ToggleButton do
IMG_٢٠٢٢٠٣٢١_١٤٣٤٤٦.jpg


B4X:
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
HC-05 :20:19:07:00:4B:61
HC-05 found
Name= HC-05
MacAddress= 20:19:07:00:4B:61
:62:98:07:3B:D8:17
INTEL-PC:3C:77:E6:F1:9C:B9
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
INTEL-PC:3C:77:E6:F1:9C:B9
HC-05 :20:19:07:00:4B:61
HC-05 found
Name= HC-05
MacAddress= 20:19:07:00:4B:61
:62:98:07:3B:D8:17
 
Upvote 0
Back
Top