How should I order the commands so that the valve can be opened and closed at the desired position?
1 回表示 (過去 30 日間)
古いコメントを表示
for i=1:5
comd2=['M03 on',tar_point];
writeline(s,comd2)
tar_point=[' X',num2str(pos(i,1)),' Y',num2str(pos(i,2)),' Z',num2str(pos(i,3))]; ้
comd1=['G01 F200 ',tar_point];
writeline(s,comd1)
pause(1.0) ์
comd3=['M05 off',tar_point];
writeline(s,comd3)
end
%Positions are placed in the 'pos' variable.
0 件のコメント
回答 (1 件)
Pratik
2024 年 1 月 5 日
Hi Matthew,
As per my understanding, you would like to write a code to automate the opening and closing of a valve and want to know what the correct order of commands will be to achieve the objective.
After analysing the code provided, the order of commands looks correct. However, in “comd2” it can be noticed that the “tar_point” variable is used before it is initialized for that position.
Please refer to the following code snippet for reference:
for i=1:5
tar_point=[' X',num2str(pos(i,1)),' Y',num2str(pos(i,2)),' Z',num2str(pos(i,3))];
comd2=['M03 on',tar_point];
writeline(s,comd2)
comd1=['G01 F200 ',tar_point];
writeline(s,comd1)
pause(1.0)
comd3=['M05 off',tar_point];
writeline(s,comd3)
end
%Positions are placed in the 'pos' variable.
I Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!