Azzera filtri
Azzera filtri

GUI arduino serial communication

1 visualizzazione (ultimi 30 giorni)
Nachiket Patki
Nachiket Patki il 9 Apr 2018
Modificato: Nachiket Patki il 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

Risposte (0)

Categorie

Scopri di più su MATLAB Support Package for Arduino Hardware in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by