//////Main
Sub main()
runscript("A작동")
runscript("B작동")
runscript("C작동")
End Sub
////////실린더A 작동
Sub A작동()
while 1
butA = GetTagVal("버튼A")
cylA = GetTagVal("실린더A")
if (butA=1) then
cylA = cylA+10
else
cylA = cylA-10
end if
Sleep(200)
SetTagVal "실린더A",cylA
Wend
End Sub
////////실린더B 작동
Sub B작동()
while 1
butB = GetTagVal("버튼B")
cylB = GetTagVal("실린더B")
if (butB=1) then
cylB = cylB+10
else
cylB = cylB-10
end if
Sleep(200)
SetTagVal "실린더B",cylB
Wend
End Sub
////////실린더C 작동
Sub C작동()
while 1
butC = GetTagVal("버튼C")
cylC = GetTagVal("실린더C")
if (butC=1) then
cylC = cylC+10
else
cylC = cylC-10
end if
Sleep(200)
SetTagVal "실린더C",cylC
Wend
End Sub
////////자동운전
Sub 자동운전()
SetTagVal "버튼A",1 ''A전진
Sleep(1000)
SetTagVal "버튼B",1 ''B전진
Sleep(1000)
SetTagVal "버튼C",1 ''집게잡기
Sleep(2000)
SetTagVal "버튼B",0 ''B후진
Sleep(1000)
SetTagVal "버튼A",0 ''A후진
Sleep(1000)
SetTagVal "버튼B",1 ''B전진
Sleep(1000)
SetTagVal "버튼C",0 ''집게풀기
Sleep(2000)
SetTagVal "버튼B",0 ''B후진
Sleep(1000)
End Sub
댓글 없음:
댓글 쓰기