Difference between revisions of "Program Examples: Events"
(created) |
|||
Line 7: | Line 7: | ||
<syntaxhighlight lang="vb"> | <syntaxhighlight lang="vb"> | ||
'------------------------------------------------------------------------------ | '------------------------------------------------------------------------------ | ||
− | ' File: | + | ' File: ev_try.prg |
− | ' Purpose: | + | ' Purpose: example of using events to catch motion event |
' Version: 1.00 | ' Version: 1.00 | ||
' Author: Eran Korkidi | ' Author: Eran Korkidi | ||
− | ' History: | + | ' History: 12.APR.2020 |
'------------------------------------------------------------------------------ | '------------------------------------------------------------------------------ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
program | program | ||
− | + | OnEvent ev1 distl(VcmdCart, VcmdCart*0) > 250 | |
− | + | Print "V > 250" | |
− | + | End Onevent | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | Attach SCARA | ||
+ | SCARA.en=1 | ||
+ | Move SCARA {0,0,0,0} | ||
+ | waitformotion SCARA | ||
+ | eventon ev1 | ||
− | + | Move SCARA {100,0,0,0} Vcruise=300 Acc=10 | |
− | + | waitformotion SCARA | |
− | |||
− | |||
− | |||
+ | Detach SCARA | ||
+ | end program | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 15:54, 12 April 2020
Language: | English |
---|
Here is an example of using Events in MC-Basic:
'------------------------------------------------------------------------------
' File: ev_try.prg
' Purpose: example of using events to catch motion event
' Version: 1.00
' Author: Eran Korkidi
' History: 12.APR.2020
'------------------------------------------------------------------------------
program
OnEvent ev1 distl(VcmdCart, VcmdCart*0) > 250
Print "V > 250"
End Onevent
Attach SCARA
SCARA.en=1
Move SCARA {0,0,0,0}
waitformotion SCARA
eventon ev1
Move SCARA {100,0,0,0} Vcruise=300 Acc=10
waitformotion SCARA
Detach SCARA
end program