Program Examples: Events

From SoftMC-Wiki
Jump to: navigation, search
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