GUI arduino serial communication
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (0)
See Also
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!