필터 지우기
필터 지우기

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