High latency while reading from multiple bluetooth objects at the same time
古いコメントを表示
I've been creating bluetooth objects in scripts to test communication with remote sensors like load-cells and encoders. But recently I attempted to create two bluetooth objects, and read from the encoder (accessed via its own BT module/object) and a load-cell (accessed via another BT module/object) quickly within the same timeframe. The issue seems that I must open and close them seperately to recieve bytes from different bluetooth objects:
fopen(encoder);
encoder_reading = fscanf(encoder, '%f');
fclose(encoder);
fopen(loadcell);
loadcell_reading = fscanf(loadcell, '%f');
fclose(loadcell);
The latency is drastic since the fopen operation takes a relatively long time to complete. But on the other hand if I try to fopen(encoder) and then fopen(loadcell) MATLAB cannot keep both open. Juggling two bluetooth connections this way yields a latency to get a single reading that is completely sporadic, ranging from 0.3 seconds to 3.8+ seconds verses keeping a single bluetooth object open and continuously reading data from that one opened BT object (0.03 - 0.04 seconds per reading on average). This renders my current setup unusable. Is there a better way? I hope I'm being stupid, but I fear this telling me that I have to rethink my experiment setup.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with Bluetooth Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!