Arduino stop to communicate with the computer during a "while" loop.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Ankita Nargundkar
am 21 Okt. 2016
Attach the crash log and the exact error message you are seeing. That will help.
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!