%take a try with matlab 2019b 64
if ~libisloaded(‘DobotDll’)
[notfound, warnings]=loadlibrary(‘DobotDll.dll’,‘DobotDll.h’);
end
ch=blanks(128);
[~,str2]=calllib(‘DobotDll’,‘SearchDobot’,ch,128);
str2ptr=libpointer(‘cstring’,str2);
[str3,str4]=calllib(‘DobotDll’,‘ConnectDobot’,str2ptr,115200);
queue_index=0;
% ptp.ptpMode=0;ptp.x=200;ptp.y=20;ptp.z=0;
ptp.ptpMode=0;
ptp.x=250.0;
ptp.y=0.0;
ptp.z=-48.0;
ptp.r=0.0;
ptpstruct=libstruct(‘tagPTPCmd’,ptp);
ptpstructptr=libpointer(‘tagPTPCmdPtr’,ptpstruct);
queue_index_ptr=libpointer(‘uint64Ptr’,queue_index);
calllib(‘DobotDll’,‘SetQueuedCmdStartExec’);
calllib(‘DobotDll’,‘SetPTPCmd’,ptpstructptr,true,queue_index_ptr);
calllib(‘DobotDll’,‘SetEndEffectorSuctionCup’,1,1,true,queue_index_ptr);
calllib(‘DobotDll’,‘SetQueuedCmdStopExec’);
pause(3)
queue_index=0;
% ptp.ptpMode=0;ptp.x=220;ptp.y=10;ptp.z=0;
ptp.x=220.0;
ptp.y=30.0;
ptp.z=-48.0;
ptp.r=0.0;
ptpstruct=libstruct(‘tagPTPCmd’,ptp);
ptpstructptr=libpointer(‘tagPTPCmdPtr’,ptpstruct);
queue_index_ptr=libpointer(‘uint64Ptr’,queue_index);
calllib(‘DobotDll’,‘SetQueuedCmdStartExec’);
calllib(‘DobotDll’,‘SetPTPCmd’,ptpstructptr,true,queue_index_ptr);
calllib(‘DobotDll’,‘SetEndEffectorSuctionCup’,0,1,true,queue_index_ptr)
calllib(‘DobotDll’,‘SetQueuedCmdStopExec’);
pause(3)
queue_index=0;
ptp.ptpMode=0;ptp.x=200;ptp.y=20;ptp.z=-10;
ptpstruct=libstruct(‘tagPTPCmd’,ptp);
ptpstructptr=libpointer(‘tagPTPCmdPtr’,ptpstruct);
queue_index_ptr=libpointer(‘uint64Ptr’,queue_index);
calllib(‘DobotDll’,‘SetQueuedCmdStartExec’);
calllib(‘DobotDll’,‘SetPTPCmd’,ptpstructptr,true,queue_index_ptr);
calllib(‘DobotDll’,‘SetQueuedCmdStopExec’);
pause(3)
calllib(‘DobotDll’,‘DisconnectDobot’);
%clear value
% clear ptpstruct;
% clear ptpstructptr;
% clear str1;
% clear str2;
% clear queue_index_ptr;
clear;