Download automated iris recognition system using cmos camera with proximity
Transcript
return;
end
% check whether serial port is currently used by MATLAB
if ~isempty(instrfind({'Port'},{comPort})),
disp(['The port ' comPort ' is already used by MATLAB']);
disp(['If you are sure that Arduino is connected to ' comPort]);
disp('then delete the object to disconnect and execute:');
disp([' delete(instrfind({''Port''},{''' comPort '''}))']);
disp('to delete the port before attempting another connection');
error(['Port ' comPort ' already used by MATLAB']);
end
% define serial object
a.aser=serial(comPort);
% connection
if strcmpi(get(a.aser,'Port'),'DEMO'),
% handle demo mode
fprintf(1,'Demo mode connection ..');
for i=1:4,
fprintf(1,'.');
pause(1);
end
fprintf(1,'\n');
pause(1);
% chk is 1 or 2 depending on the script running on the board
chk=round(1+rand);
else
% actual connection
% open port
try
fopen(a.aser);
catch ME,
disp(ME.message)
delete(a);
error(['Could not open port: ' comPort]);
end
% it takes several seconds before any operation could be attempted
59