Connecting Bluetooth Device to Matlab

3 visualizaciones (últimos 30 días)
Hana Hashioka
Hana Hashioka el 10 de Jun. de 2022
Editada: Chandrika el 10 de Jun. de 2022
How do I code to see the list of Bluetooth devices and how to connect to one of them? Thank you and I am a new matlab user so beginner language is appreciated

Respuestas (1)

Chandrika
Chandrika el 10 de Jun. de 2022
Editada: Chandrika el 10 de Jun. de 2022
As per my understanding, you want to programatically view the list of all available bluetooth devices, and connect to one.
In MATLAB. we can achieve the first requirement of scanning all nearby bluetooth devices using the 'bluetoothlist' function. It lists all available bluetooth devices alongwith information on each of their connection status.
devicelist = bluetoothlist
Here 'devicelist' is the output that corresponds to a table having information on names of the identified bluetooth devices along with their addresses, device channels, and their connection status. For more information on the output arguments generated by the 'bluetoothlist' function, follow the documentation on Output arguments of bluetoothlist
Before using the 'bluetoothlist' function, make sure that your device is not connected to any other device.
Further, for connecting your device to any one of the bluetooth devices discovered by MATLAB, you shall need to create a bluetooth object for your device using information on bluetooth names and channels provided by the 'bluetoothlist' function.
For devices having connection status as "Ready to Connect", the following function can be used as a workaround solution.
device = bluetooth("HC-06",1)
Here, 'HC-06' corresponds to the name of the bluetooth device, and 1 corresponds to the channel associated with it.
For better understanding, please refer to the documentation on bluetooth

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by