Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure bluetoothctl to connect Bluetooth and play music

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to configure bluetoothctl to achieve Bluetooth connection and play music". In daily operation, I believe many people have doubts about how to configure bluetoothctl to achieve Bluetooth connection and play music. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "how to configure bluetoothctl to achieve Bluetooth connection and play music". Next, please follow the editor to study!

1. Install bluetoothctlsudo apt-get install pi-bluetooth2. Configuration. If the configuration times out, you need to retry sudo hciattach / dev/ttyAMA0 bcm43xx 921600 noflow-

As shown in the following figure, the output Device setup complete indicates that the configuration is successful.

3. Enter bluetoothctlsudo bluetoothctl

As shown in the following figure, the output of Agent registered indicates that it is successful

4. Turn on Bluetooth power on

As shown in the following figure, the output of Changing power on succeeded indicates that it is successful

5. Can be found discoverable on

As shown in the following figure, the output of Changing discoverable on succeeded indicates that it is successful

6. Search for device scan on

As shown in the following figure, the output of Discovery started indicates that it is successful

At this point, you can continue to use settings to discover and connect Bluetooth.

7. Stop searching for device scan off8. Connect the equipment

Once you have found the MAC address of the device to which you want to connect, you can now continue to pair the Raspberry Pi with it.

① in order for Bluetooth to pair the device to the Raspberry Pi, you need to use the following command:

Pair [XX:XX:XX:XX:XX:XX]

Example: connect Xiaomi mobile phone

Pair F4:60:E2:D0:F8:B6

When ② paired the device for the first time, it immediately connected to the device. However, once you are out of the Bluetooth range of Raspberry Pi, you will need to reconnect the device using the following command.

Connect [XX:XX:XX:XX:XX:XX]

③ if you do not want to repair the device, you can use the rust command.

This command works like the other two commands and requires the MAC address of the Bluetooth device you want to trust.

Trust [XX:XX:XX:XX:XX:XX]

After the initial pairing, you can trust the Bluetooth device on the Raspberry Pi.

9. Give it a try.

Install the player:

Installing Sox [Sound eXchange) on Ubuntu is a Swiss Army knife that operates sound files. It can play and convert audio files and add effects. ]:

Sudo apt-get install sox libsox-fmt-all

Libsox-fmt-all contains decoders for mp3 and decoders for other formats.

Play music:

Play Hongyan. MP3 at this point, the study on "how to configure bluetoothctl to connect to Bluetooth and play music" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report