Warning: Unsuccessful read: A timeout occurred before the Terminator was reached. 'serial' unable to read any data

Hello!
I am trying to read data from Arduino uno but get this error
"Warning: Unsuccessful read: A timeout occurred before the Terminator was reached. 'serial' unable to read any data".
Can anyone help me please?
Thank you in advance!
clear All
close All
COM = serial('COM2','BaudRate',9600);%5,'Terminator','CR');
set(COM,'TimeOut',10)
fopen(COM);
interv = 240;
init_time = 1;
x =0;
while (init_time < interv)
b = fscanf(COM) ;
b = b(2:end-2);
b = bin2dec(b);
x = [x,b];
plot(x);
grid on ;
init_time = init_time+1;
drawnow;
end
fclose(COM);
delete(COM);
clear COM;

답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

질문:

2020년 12월 25일

편집:

2020년 12월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by