Bluetooth Communications error on Matlab

6 ビュー (過去 30 日間)
Diogo Simões
Diogo Simões 2020 年 4 月 29 日
コメント済み: Diogo Simões 2020 年 5 月 3 日
b = Bluetooth('A4933F4074D4',1);
>> fopen(b)
Error using icinterface/fopen (line 83)
Unsuccessful open: Cannot connect to the device. Possible reasons are another application is connected
or the device is not available.
The device was paired before starting Matlab, i was able to create the b variable but cannot seem to open the connection
b
Bluetooth Object : Bluetooth-A4933F4074D4:1
Communication Settings
RemoteName: a4933f4074d4
RemoteID: btspp://
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
Does anyone know how to solve this?
>>

回答 (1 件)

Samatha Aleti
Samatha Aleti 2020 年 5 月 3 日
Hi,
Get the object constructor which includes the correct channel ID by running the following command:
btInfo = instrhwinfo('Bluetooth',RemoteName);
Create the object accordingly using the “object constructor”.
Make sure to follow and verify the steps mentioned here
  1 件のコメント
Diogo Simões
Diogo Simões 2020 年 5 月 3 日
Hi, I did as you said in the first times i tried, just in case i did it again and the result was the same:
btInfo = instrhwinfo('Bluetooth','P Smart');
btInfo =
HardwareInfo with properties:
RemoteName: 'P smart'
RemoteID: 'btspp://A4933F4074D4'
ObjectConstructorName: {'Bluetooth('P smart', 1);'}
Channels: {'1'}
Then I tried to create the object and it was successfull
bt = Bluetooth('P Smart', 1);
>> bt
Bluetooth Object : Bluetooth-P Smart:1
Communication Settings
RemoteName: p smart
RemoteID: btspp://A4933F4074D4
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
The error as always, keeps appearing
>> fopen(bt)
Error using icinterface/fopen (line 83)
Unsuccessful open: Cannot connect to the device. Possible reasons are another application is connected
or the device is not available.
If you have any further insights on this I would appreciate it

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBluetooth Low Energy Communication についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by