大家好
最近在研究兩組運動感測器各接arduino 與藍芽無線(HC-05)並把資料輸出至MATLAB即時繪圖
目前確實兩組感測器都可以收到資料
拔掉藍芽改有線的話兩組可以同時無延遲即時輸出
只接一組感測器的話無線有線都可以無延遲即時輸出
但目前遇到兩組都改成藍芽輸出MATLAB時會有其中一組延遲大概兩秒另外一組則是可以無延遲即時輸出
請求專家幫忙或給點意見 謝謝 試過好多種方法仍然改變不了延遲問題
HC-05 is actually a bluetooth SPP device, so we cannot use traditional serial function in matlab, because its only support "real" COM port.
However, matlab give us a similar lib named "bluetooth" :
http://www.mathworks.com/help/instrument/bluetooth-communication.html
You can apply ccde as below to access the HC-05:
1. first make sure you havn't change the device name of you HC-05, default is "HC-05", you can check it at your bluetooth Properities menu at Control Panel.
2. Code
%creat a bluetooth object%HC-05 channel default is 1b = Bluetooth('HC-05',1);fopen(b);%write and read functionfwrite(b,Bluetooth_Write,'uchar');Bluetooth_Read=fgets(b);%close and clearfclose(b);clear(b);歡迎光臨 Robofun 機器人論壇 (https://robofun.net/forum/) | Powered by Discuz! X3.2 |