Hello,
You should be able to find a "Scripting Manual.pdf" within your Mach4 installation directory (Mach4Hobby/Docs/Scripting Manual.pdf). In that manual, a good example can be found on page 18.
Additionally, a "LuaCalls.txt" file can be found in this same directory which contains all the available scripting commands.
local inst = mc.mcGetInstance()
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEFWD)
local spinstate = mc.mcSignalGetState(hsig)
if (spindstate == 0) then
mc.mcSignalSetState(hsig, 1)
else
mc.mcSignalSetState(hsig, 0)
end
In the case of your "Laser Ready", you can use one of the generic signals (e.g. ISIG_INPUT0 etc.). The same goes for the output that you'd want to activate (e.g. OSIG_OUTPUT0 etc.)
For waiting, you can keep checking the state of your input under a while loop and using a sleep.
input1State = mc.mcSignalGetState(input1Handle)
while input1State <> 0 do
wx.wxMilliSleep(100)
input1State = mc.mcSignalGetState(input1Handle)
end
mc.mcSignalSetState(output1Handle, 0)
I do recommend that you go through the documents that I had mentioned above, otherwise my explanation may make little sense without prior knowledge of how lua scripting works in Mach4.
-Marc
Vital System Inc.