Filter löschen
Filter löschen

GUI arduino serial communication

1 Ansicht (letzte 30 Tage)
Nachiket Patki
Nachiket Patki am 9 Apr. 2018
Bearbeitet: Nachiket Patki am 9 Apr. 2018
Hello, I have created a GUI where I am going to capture an image and perform some operations only after I get an interrupt from arduino. Arduino gives interrupt after every 60 sec(It can be anything). So after the first interrupt, I want the camera to take snapshot (meanwhile the timer should be ON at background counting 60 sec). This is what is expected but when I tried to do this either I can access the camera or I can do the serial communication but not both. This is my code:
%Start Your Timer
p1='';
while 1
set(r, 'Timeout',5);
p= fgets(r);
if ~strcmp(p,p1)
if strcmp(p,'N') %Comes after 60 sec
vid= videoinput('winvideo', 1);
axes(handles.axes2);
hImage=image(zeros(640,480,3),'Parent',handles.axes2);
preview(vid,hImage)
end
if strcmp(p,'C') %Comes after 60 sec
%Do something else
end
end
end
How can I do it simultaneously? Any help? Thank you

Antworten (0)

Kategorien

Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by