Matlab 2019b BLE communication with a peripheral

5 次查看(过去 30 天)
Matlab 2019b has integrated the function to connect Bluetooth Low Energy (BLE) devices. So I tried to read sensor data from TI’s CC2650 Sensortag. I have managed to find the device, establish connection and read the sensor data. I notice the characteristic can bind with a callback function through the property DataAvailableFcn. This could be a handy way to automatically read data published from the sensors. I have managed to bind the callback function and it can read the sensor data automatically.
The problem comes when I tried to read sensortag with a high sampling rate, for example 10Hz. It looks the read function can only read either the oldest or the latest data and it can only respond the notification once. This causes a delay in reading the data in the buffer.
Any suggestions to solve this problem? Thanks.
  2 个评论
Balrog
Balrog 2020-7-15
Interestingly, I too notice that the notification function doesn't respond continuously - Sometimes once or twice. I am not sure what's the issue though
Joris Lambrecht
Joris Lambrecht 2021-2-5
I had a problem using the DataAvailableFcn until I realized I had called subscribe multiple times to the same charachteristic. The DataAvailableFcn got called for each subscription and I would get multiple copies of the same data. Calling unsubscribe didn't solve the problem, once I had subscribed more than once, so I cleared the object created with ble() and started over. Not sure if this is relevant to your situation, but it confused me for a while.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by