Arduino stop to communicate with the computer during a "while" loop.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
i have a trouble with arduino. I wrote a while loop that delete, for each cycle, the first number of a matrix. During the loop some time the connection with arduino is lost, and the program crash.
here an example of the matlab script
ar = arduino();
x = [0, 1, 1, 0, 1, 0, 0 ,1, 1];
counter = 0;
while ~isempty(x);
counter = counter +1;
if x(1) == 1;
writeDigitalPin(ar,'D13',1);
end;
if x(1) == 1;
writeDigitalPin(ar,'D13',0);
end;
x(1) = [];
end
I don't know why it happened.
Does it depend on the usb cable that connect arduino to the computer? I had to add a usb prolong form the arduino USB.
댓글 수: 0
답변 (1개)
Ankita Nargundkar
2016년 10월 21일
Attach the crash log and the exact error message you are seeing. That will help.
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!