Bluetooth communication through Matlab error
2 views (last 30 days)
Show older comments
Hello all,
I've started looking at communicating with devices using bluetooth, and have run into a few problems. I've already had a read through Configuring Bluetooth Communications, Transmitting Data Over the Bluetooth Interface and a couple of community questions and not found a solution.
>> instrhwinfo('Bluetooth')
ans =
RemoteNames: {'itsmedoug'}
RemoteIDs: {'btspp://D4206DADA6AA'}
BluecoveVersion: 'BlueCove-2.1.1-SNAPSHOT'
JarFileVersion: 'Version 3.2'
So far, so good, but if I try to access the device 'itsmedoug' directly, I get an empty structure:
>> instrhwinfo('Bluetooth', 'itsmedoug')
ans =
RemoteName: []
RemoteID: []
ObjectConstructorName: []
Channels: []
Any idea why this should be the case?
If I assume that the channels are indexed from 1, I can open a connection:
>> bt = Bluetooth('itsmedoug', 1)
Bluetooth Object : Bluetooth-itsmedoug:1
Communication Settings
RemoteName: itsmedoug
RemoteID: btspp://D4206DADA6AA
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> fopen(bt)
Which doesn't return an error (unlike when I use channel 0, 2, 3, etc...) But then when I try to write to the device:
>> fwrite(bt, uint8([2,0,1,155]))
Error using icinterface/fwrite (line 191)
An error occurred during writing
I'm assume this is a manifestation of the same issue, though I'm not sure.
The device is paired in Windows Explorer, and I'm using R2012b.
Any help would be much appreciated.
4 Comments
Answers (0)
See Also
Categories
Find more on MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!