GUI arduino serial communication
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 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!