How should I order the commands so that the valve can be opened and closed at the desired position?

1 visualización (últimos 30 días)
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.

Respuestas (1)

Pratik
Pratik el 5 de En. de 2024
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.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by