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.

回答(1 个)

Pratik
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.

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by