回復 1# x10532x
買藍芽無線(HC-06ˊ)從機`比較容易,Hc-05主從一體 你必須注意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); |