Bluetooth Serial Connection Matlab Gui

I am sending accelerometer data via bluetooth into Matlab where I will process it and build a GUI. I am currently working on getting the bluetooth data into Matlab. I'm using a dongle which gets data into port COM18. This is the code I'm using: s= serial ('COM18'); set(s,'DataBits',8); set(s,'StopBits',1); set(s,'BaudRate',9600); set(s,'Parity','none'); fopen(s); When I start from scratch (disconnect and connect bluetooth and dongle, reopen matlab etc) The port successfully opens and allows me to read data. However, if I close and then try to open, it will give me an error: Error using serial/fopen (Line 72) Open failed: Port COM 18 is not available. Available ports: COM6, COM7, COM19.

Use INSTRFIND to determine if other instrument objects are connected to the requested device. I know that my device isn't connected to anything else. So I then have to disconnect my bluetooth, dongle, and restart matlab.

Is there a more efficient way to do this? Also, I am able to get values from my accelerometer into Matlab, but I don't know how to make them continuous. Each time 512 bytes are sent and if my ValuesReceived exceeds 12000, I once again have to restart my bluetooth device to get more values. I've tried flushoutput, but it hasn't worked. Any ideas on how to get continuous data into Matlab so I can process it in my GUI?

Description The Instrument Control Toolbox™ Bluetooth ® interface lets you connect to devices over the Bluetooth interface and to transmit and receive ASCII and binary data. Instrument Control Toolbox supports the Bluetooth Serial Port Profile (SPP). You can identify any SPP Bluetooth device and establish a two-way connection with that device. B = Bluetooth('RemoteName', Channel) constructs a Bluetooth object associated with the RemoteName and Channel. RemoteName is a friendly way to identify the RemoteID. If a channel is not specified, it will default to 0. B = Bluetooth('RemoteID', Channel) constructs a Bluetooth object directly from the RemoteID and Channel.

Nov 25, 2016 - I am trying to use the SSP as a COM port to receive data from MCU. I have to try many times to connect to the COM port, but it often failed to.

In order to communicate with the Bluetooth device, use the fopen function. 7.5 pill. When the Bluetooth object is constructed, the object's status property is closed.

Once the object is connected to the remote device with the fopen function, the status property is configured to open. B = Bluetooth('RemoteID', Channel, 'P1',V1,'P2',V2.) constructs a Bluetooth object associated with the RemoteID, Channel and with the specified property values. If an invalid property name or property value is specified the object will not be created.

The property value pairs can be in any format supported by the set function, i.e., param-value character vector pairs, structures, and param-value cell array pairs. For information on other functions that can be used with Bluetooth, a full example using the Bluetooth interface, events and callbacks, and usage guidelines see. Properties that can be used with the Bluetooth object include. Property Description Channel Use to specify a channel if the device has channels. If none is provided, it defaults to 0.

RemoteName “Friendly name” for the Bluetooth device. For example, in the case of an iPhone, it might be simply 'iPhone' or a name like 'Zor'.

This property is a character vector and can be empty. If it is empty, you must use the RemoteID to communicate with the device. RemoteID Internal ID of the Bluetooth device, equivalent to the Device ID. This is usually a 12-digit character vector that starts with btspp://. For example, 'btspp://0016530FD65F' This property is a character vector and every device has one. You can use this or the RemoteName to communicate with the device.

    Search