Issue reading COM port data (MATLAB 2015a)
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I have connected my sensor output to an Arduino and its output through a USB cable to COM Port. I tried the following code in MATLAB
===================================
s=instrhwinfo('Serial');
s.AvailableSerialPorts
===================================
and observed that MATLAB does detect my COM Port successfully.
Then I defined my serialPort and then I tried the following code
===================================
board = serial(serialPort, 'BaudRate', 115200, 'FlowControl','None');
fopen(board);
S = fscanf(board)
===================================
I am just getting one line message that reads
Initializing I2C devices...
Whereas I expect a three line message where the third line asks for any key-press to continue.
When I execute the following line again
S = fscanf(board)
I get the second line and then the third line when I run the code again
After that I get the following error
Warning: Unsuccessful read: A timeout occurred before the Terminator was reached..
S =
''
When I do that it Hyper-terminal, it does work as expected. My requirement is to see the same data which I get in Hyper Terminal to be ready here in MATLAB Command window.
Please help.
0 件のコメント
回答 (0 件)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!