Issue reading COM port data (MATLAB 2015a)
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!