How to use the command to connect Bluetooth?-BPI-F3

First, start F3 and connect to the serial port for debugging.

Use the command to query Bluetooth devices

hciconfig

image

Turn on the Bluetooth function

sudo bluetoothctl    //Turn on Bluetooth debugging
power on                //Open the Bluetooth network card
discoverable on      //Set the controller to discoverable
pairable on        //Set the controller to be pairable

image

Scan Bluetooth

Use the command to start the scan. If you want to stop the scan, you can also use this command.

scan on              //Scan MAC addresses of other Bluetooth devices
scan off              //Close scanning

Enable the proxy functionality

agent on                //Open the agent for connecting to other Bluetooth devices

image

Connect to a Bluetooth device

Use command binding and connect Bluetooth(You can also give it a try with the following other commands)

pair <MAC address>      //Pairing Bluetooth devices
disconnect <MAC address>  //Disconnect
remove  <MAC address>   //Unpairing
connect <MAC address>  //Connecting a Bluetooth device
exit

image

Look, you have successfully connected to the Bluetooth device.