Answer the question
In order to leave comments, you need to log in
What port should be specified in order to connect from a computer to an android device using Python?
There is a bluetooth button designed to connect to an Android mobile phone
There is a code from the instructions for the pybluez library: https://people.csail.mit.edu/albert/bluez-intro/x2...
import bluetooth
bd_addr = "01:23:45:67:89:AB"
port = 1#какой порт указать?
sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
sock.connect((bd_addr, port))
bluetooth.discover_devices()
Answer the question
In order to leave comments, you need to log in
First you need to figure out what kind of interaction (according to what protocol) this "bluetooth button" supports, and from this already "dance". Trying to randomly open a port if the device is not listening to it is a peculiar occupation.
I suspect that this "button" is a HID-device, i.e. looks like a banal blue-toothed keyboard, so look here for example:
https://shkspr.mobi/blog/2016/02/cheap-bluetooth-b...
Depending on socket type: https://developer.android.com/reference/android/bl...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question