- Make sure that the device is paired prior to accessing it in MATLAB
- The line where you create bt is incorrect
Bluetooth Communication over MatLab
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Chris Morman
 am 3 Apr. 2012
  
    
    
    
    
    Kommentiert: Diogo Simões
 am 29 Apr. 2020
            I'm trying to send a simple binary file to a paired bluetooth device, but having a lot of difficulty. I'm using 2012a, so the bluetooth support is available.
Following is a sample of my setup to ensure that I am paired with the device.
>> instrhwinfo('bluetooth')
ans = 
          RemoteNames: {6x1 cell}
            RemoteIDs: {6x1 cell}
      BluecoveVersion: 'BlueCove-2.1.1-SNAPSHOT'
       JarFileVersion: 'Version 3.0.0'
>> ans.RemoteNames
ans = 
      'FRANK'
      'WENDY-VAIO'
      'FRANK-PC'
      'DESALLAR-WS'
      'HOMEPC'
      'CHRIS-PC'
>> bt = Bluetooth('FRANK')
     Bluetooth Object : Bluetooth-FRANK:0
     Communication Settings 
        RemoteName:         FRANK
        RemoteID:           002243F270C7
        Channel:            0
        Terminator:         'LF'
     Communication State 
        Status:             closed
        RecordStatus:       off
     Read/Write State  
        TransferStatus:     idle
        BytesAvailable:     0
        ValuesReceived:     0
        ValuesSent:         0
At this point I need to change the Communication state to open so I can use the fwrite command. This is where I have a problem.
I use the fopen command to establish the connection, but get the following error.
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.
Where do I go from here?
I've read that others have set up a COMM port, but I am of the understanding that this is not needed with 2012a. Is that right?
I know next to nothing about bluetooth connectivity and/or communication. So any information is greatly appreciated.
Thanks
0 Kommentare
Akzeptierte Antwort
  Ankit Desai
    
 am 5 Apr. 2012
        Hi Chris,
You might want to consider a couple of things:
You need to pass the channel ID as the second parameter to Bluetooth.
To find out the correct channel ID, use the following function:
btInfo = instrhwinfo('Bluetooth','FRANK')
That should give you the object constructor, including the channel ID required.
Hope that helps.
-Ankit
9 Kommentare
  Vinod
    
 am 14 Dez. 2017
				What Operating System are you using? What is the version of MATLAB you are using?
  Diogo Simões
 am 29 Apr. 2020
				My fopen keeps  telling me it can't connect in spite of doing it like Ankit Desai wrote in the first comment
Weitere Antworten (1)
  siddesh pawar
 am 9 Sep. 2016
        Communication State 
    Status:             closed
    RecordStatus:       off
HOW TO SET IT ON.., I.E how to transmit the data 1
0 Kommentare
Siehe auch
Kategorien
				Mehr zu National Instruments Frame Grabbers finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!









